Token-based authentication for a proxy web scraping service

ABSTRACT

Embodiments disclose a system that allows for improved generation of web requests for scraping that, because of the nature of the requests and time and manner they are sent out, appear more organic, as in human generated, than conventional automated scraping systems. The system then manages how a client request to scrape a target website is made to the site, masking the request in a manner that makes it appear to the Web server as if the request is not generated by an automated system. In this way, by appearing more organic, Web servers may be less likely to block requests from the disclosed system or may take longer to block requests from the disclosed system. By avoiding Web servers blocking requests and extending the lifetime of IP proxies before they are blocked, embodiments can use a limited IP proxy address space more efficiently.

CROSS-REFERENCE TO RELATED APPLICATIONS

This is a continuation of U.S. patent application Ser. No. 17/699,939,filed Mar. 21, 2022, which is a continuation of U.S. patent applicationSer. No. 17/373,570, filed Jul. 12, 2021, which claims priority to U.S.Provisional Application No. 63/219,660, filed Jul. 8, 2021. The contentsof each of these applications is incorporated herein by reference intheir entirety.

BACKGROUND Field

This field is generally related to web scraping.

Related Art

Web scraping (also known as screen scraping, data mining, webharvesting) is the automated gathering of data from the Internet. It isthe practice of gathering data from the Internet through any means otherthan a human using a web browser. Web scraping is usually accomplishedby executing a program that queries a web server and requests dataautomatically, then parses the data to extract the requestedinformation.

To conduct web scraping, a program known as a web crawler may be used. Aweb crawler, sometimes called a web spider, is a program or an automatedscript which performs the first task, i.e. it navigates the web in anautomated manner to retrieve data, such as Hypertext Transfer MarkupLanguage (HTML) data, JSONs, XML, and binary files, of the accessedwebsites.

Web scraping is useful for a variety of applications. In a firstexample, web scraping may be used for search engine optimization. Searchengine optimization (SEO) is the process of improving the quality andquantity of website traffic to a website or a web page from searchengines. A web search engine, such as the Google search engine availablefrom Google Inc. of Mountain View, California, has a particular way ofranking its results, including those that are unpaid. To raise thelocation of a website in search results, SEO may, for example, involvecross-linking between pages, adjusting the content of the website toinclude a particular keyword phrase, or updating content of the websitemore frequently. An automated SEO process may need to scrape searchresults from a search engine to determine how a website is ranked amongsearch results.

In a second example, web scraping may be used to identify possiblecopyright. In that example, the scraped web content may be compared tocopyrighted material to automatically flag whether the web content maybe infringing a copyright holder's rights. In one operation to detectcopyright claims, a request may be made of a search engine, which hasalready gathered a great deal of content on the Internet. The scrapedsearch results may then be compared to a copyrighted work.

In a third example, web scraping may be useful to check placement ofpaid advertisements on a webpage. For example, many search engines sellkeywords, and when a search request includes the sold keyword, theyplace paid advertisements above unpaid search results on the returnedpage. Search engines may sell the same keyword to various companies,charging more for preferred placement. In addition, search engines maysegment as sales by geographic area. Automated web scraping may be usedto determine ad placement for a particular keyword or in a particulargeographic area.

In a fourth example, web scraping may be useful to check prices orproducts listed on e-commerce web sites. For example, a company may wantto monitor a competitor's prices to guarantee that their prices remaincompetitive.

To conduct web scraping, the web request may be sent from a proxyserver. The proxy server then makes the request on the web scraper'sbehalf, collects the response from the web server, and forwards the webpage data so that the scraper can parse and interpret the page. When theproxy server forwards the requests, it generally does not alter theunderlying content, but merely forwards it back to the web scraper. Aproxy server changes the request's source IP address, so the web serveris not provided with the geographical location of the scraper. Using theproxy server in this way can make the request appear more organic andthus ensure that the results from web scraping represent what wouldactually be presented were a human to make the request from thatgeographical location.

Proxy servers fall into various types depending on the IP address usedto address a web server. A residential IP address is an address from therange specifically designated by the owning party, usually Internetservice providers (ISPs), as assigned to private customers. Usually aresidential proxy is an IP address linked to a physical device, forexample, a mobile phone or desktop computer. However, businesswise, theblocks of residential IP addresses may be bought from the owning proxyservice provider by another company directly, in bulk. Mobile IP proxiesare a subset of the residential proxy category. A mobile IP proxy is onewith an IP address that is obtained from mobile operators. Mobile IPproxies use mobile data, as opposed to a residential proxy that usesbroadband ISPs or home Wi-Fi. A datacenter IP proxy is the proxy serverassigned with a datacenter IP. Datacenter IPs are IPs owned bycompanies, not by individuals. The datacenter proxies are typically IPaddresses that are not in a natural person's home.

Exit node proxies, or simply exit nodes, are gateways where the traffichits the

Internet. There can be several proxies used to perform a user's request,but the exit node proxy is the final proxy that contacts the target andforwards the information from the target to a user device, perhaps via aprevious proxy. There can be several proxies serving the user's request,forming a proxy chain, passing the request through each proxy, with theexit node being the last link in the chain that ultimately passes therequest to the target.

E-commerce and search engine sites may prefer not to service webscraping requests or may try to limit web scraping requests. To thatend, these sites may try to determine which of the requests it receivesare automated and which requests are in response to a human web browsingrequest. When a web server identifies a request that the server believesto be automated, the server may block all requests coming from thatproxy or requests having certain parameters from that proxy.

To identify which requests are automated, a web server may try todetermine whether web requests coming from a particular IP address orsubnet satisfy a pattern over time. To avoid detection, proxies may berotated so that no single IP address makes too many requests. However,the supply of proxy IP addresses is limited. The IP address space(especially in IP version 4) in general is constrained. This limitedsupply is exasperated because many of the available IP addresses arelabeled as data center IPs, and many target websites likely to bescraped refuse to service web requests from those IP addresses. As aresult of the limited supply, the cost of obtaining a proxy IP addresshas increased. Taking proxy IP addresses out of circulation too quicklyraises the cost of web scraping.

Systems and methods are needed for improved web scraping.

BRIEF SUMMARY

In an embodiment, a method is provided for distributing applicationprogramming interface (API) requests over a plurality of data centers ina web scraping system to ensure that the API requests are routed to thedata center with the requested data. In the method, an API request froma client computing device is received. The API request relates to a webscraping job that was previously requested of a web scraping system. Ahostname addressing a data center of the web scraping system thatserviced the web scraping job is identified. The API request is sent tothe identified hostname. Finally, the API request is serviced at theidentified data center.

System and computer program product embodiments are also disclosed.

Further embodiments, features, and advantages of the invention, as wellas the structure and operation of the various embodiments, are describedin detail below with reference to accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated herein and form partof the specification, illustrate the present disclosure and, togetherwith the description, further serve to explain the principles of thedisclosure and to enable a person skilled in the relevant art to makeand use the disclosure.

FIG. 1 is an architecture diagram illustrating a system that allows aclient to scrape web content through a proxy.

FIG. 2 illustrates an example operation of the system in FIG. 1 andprovides further description of how the system's components mayinteract.

FIG. 3 is an architecture diagram illustrating aspects of a web scrapingsystem in greater detail.

FIG. 4 is an architecture diagram showing components of a web scrapingsystem in greater detail.

FIG. 5 illustrates a web scraping system with a throttler, according toan embodiment.

FIG. 6 is a diagram illustrating how web requests can be throttled andtrickled out over time.

FIG. 7 is a system diagram illustrating how the throttling mechanism canbe implemented in a web scraping system.

FIG. 8 is a system diagram illustrating how traffic counting can beimplemented in a web scraping system.

FIG. 9 is a flowchart illustrating a method for counting and regulatingtraffic in a web scraping system.

FIG. 10 illustrates operation of various components of a web scrapingsystem to detect whether its various database servers should be enabledor disabled.

FIG. 11 illustrates various components of a web scraping system toselect an enabled database server to process a web scraping request.

FIGS. 12A-B illustrate systems for load balancing web scraping requeststhat direct a request for results to the same subdomain that requestedcontent from a target.

FIGS. 13A-B illustrate methods for operation of the systems in FIGS.12A-B.

FIG. 14 illustrates a system for token-based authentication at a loadbalancer for a web scraping system.

FIG. 15 illustrates token-based authentication for a web scraping systemin greater detail.

FIG. 16 illustrates a system that stores results from a plurality ofdata centers into an archive database.

FIG. 17 illustrates a system that de-duplicates from a plurality of datacenters before storing into an archive database.

The drawing in which an element first appears is typically indicated bythe leftmost digit or digits in the corresponding reference number. Inthe drawings, like reference numbers may indicate identical orfunctionally similar elements.

DETAILED DESCRIPTION

Embodiments disclose a system that allows for improved generation of webrequests for scraping that, because of the nature of the requests andthe time and manner in which they are sent out, appear more organic, asin “human generated,” than conventional automated scraping systems. Inan example operation, a client may send a request to the system toscrape a particular site. Within the parameters the client provides, thesystem then manages how the request is made to the site, masking therequest in a manner that makes it appear to the web server as if therequest is not generated by an automated system. In this way, by makingthe request appear more organic, web servers may be less likely to blockrequests from the disclosed system or may take longer to block requestsfrom the disclosed system. By avoiding web servers blocking requests andextending the lifetime of IP proxies before they are blocked,embodiments can use a limited IP proxy address space more efficiently.Aspects of a web scraping system that makes scraping requests throughproxies are described with respect to FIGS. 1-4 .

For various applications, clients may require automated scraping of webcontent.

Some websites try to block requests that the websites believe to beautomated. To determine whether requests are automated, these websiteslook at patterns of requests received over time from particular sources.For that reason, sources can be used to originate automated requests forweb content only so frequently before the websites requested begin torecognize that the requests are automated. In part, to deal with this,embodiments throttle requests on a per-client basis. Throttling involvesqueuing requests from a client and executing requests from the queue ona periodic basis. In one example embodiment, a queue may be specific toa particular client, a target, and as to whether the request was madethrough a headless browser. Aspects of throttling web scraping requestsare described with respect to FIGS. 5-7 .

Traditionally, proxy web scraping services may have tracked useractivity on by tracking a number of requests made for invoicingpurposes. According to embodiments, user activity for proxy web basedscraping services is tracked based on network traffic generated. Inparticular, when a response is received to a web scraping request, theamount of data transferred over a physical network layer may becalculated. Depending on product, pricing plan and possibly otherparameters, the request might be counted as well. To calculate theamount of data, an adjustment may be made to the total amount of datareceived to account for compression that occurs when the data istransferred. In addition, the amount of data may exclude requests andresponses needed to acquire session information to request the scrapedtraffic. Aspects of tracking network traffic generated by web scrapingrequests are described with respect to FIGS. 8-9 .

Requests for web scraping may be placed in a database while they arebeing executed. The database may hold status information pertinent tothe request. To store and provision data, a plurality of databaseservers, sometimes called shards, may be used. When an update or queryis made to the database, the update or query may be sent to the databaseserver which stores the database for update or data queried. Sometimes,database servers can become overwhelmed or otherwise hung up. Accordingto an embodiment, “heartbeats” are periodically sent to the databaseservers to determine which ones are available and which ones may haveissues. A shared memory location may be used where the status of a shardcould be indicated to be unavailable. Based on that information, newrequests for web scraping may be sent to those database serversdetermined to be available and not to those determined to beunavailable. There is a shared memory location where the status of ashard could be indicated to be unavailable, but the “heartbeat” is stillcarried out by each of the user services. Aspects of this databaseserver management technique are described below with respect to FIGS.10-11 .

A web scraping service may include a plurality of web scraping serversand a load balancing server to distribute load between the plurality ofweb scraping servers. The web scraping servers are configured toregister and conduct web scraping requests. When a new request isreceived, the load balancing server determines which of the plurality ofweb scraping servers conduct the request. Each of the plurality of webscraping servers may be located in a different data center location. Thenew request for web scraping is directed to a data center determined bya load-balancing server. To retrieve the results of the web scraping, aclient may send a subsequent request. According to an embodiment, theload balancing server may determine which of the plurality of datacenters executed the original request. Then, the load balancing servermay direct the subsequent request to the same data center. In this way,data can be more efficiently retrieved from the same data center thatserviced the web scraping request. Aspects of this direct data centeraccess are described below with respect to FIGS. 12A-B and 13A-B.

A web scraping service may include a plurality of web scraping serversand a load balancing server. The web scraping servers are configured toregister and conduct web scraping requests. When a new request isreceived, the load balancing server determines which of the plurality ofweb scraping servers conduct the request. Authentication needs to beconducted to determine whether the request is authorized. According toan embodiment, the load balancing server accesses an authenticationserver that assesses credentials provided with an API request todetermine whether the credentials are valid. When the credentials arevalid, the authentication server returns to the load balancing server, atoken, indicating the user's identity and role. The load balancingserver then forwards the token along with the request to the websitescraping server, and the website scraping server uses the token toverify that the request is authorized. Aspects of this token-basedauthentication are described below with respect to FIGS. 14 and 15 .

Web scraping services can keep a history of web pages previouslyscraped. The history may be stored by a plurality of data centers, eachmaintaining their own index. When a request to look up previouslyscraped webpages is received, the various indexes stored across multipledata centers are assessed and the results from the respective datacenters are combined. In a further embodiment, web scraping results arede-duplicated across multiple data centers. This operation of an archiveof web scraping results across multiple data centers is described withrespect to FIGS. 16 and 17 .

Automated web scraping through proxies

FIG. 1 is an architecture diagram illustrating a system 100 that allowsa client to scrape web content through proxy. System 100 includes aclient computing device 102, web scraping system 104, a plurality of webproxies 106A . . . N, and a target web server 108. Each of thesecomponents include one or more computing devices and are connectedthrough one or more networks 110.

Client computing device 102 is a computing device that initiatesrequests to scrape content from the web, in particular target web server108. As described above, client computing device 102 may seek to scrapecontent for various applications. For example, client computing device102 may have or interact with software to engage in search engineoptimization. Client computing device 102 may be analyzing ad placementor e-commerce products or listed prices. Client computing device 102sends a request to web scraping system 104. The request can besynchronous or asynchronous and may take a variety of formats asdescribed in more detail with respect to FIG. 2 .

Web scraping system 104 develops a request or a sequence of requeststhat impersonate a human using a web browser. To impersonatenon-automated requests to a target website, web scraping system 104 haslogic to formulate Hypertext Transfer Protocol (HTTP) requests to thetarget website. Still further, many of these sites require HTTP cookiesfrom sessions generated previously. An HTTP cookie (usually just calleda cookie) is a simple computer data structure made of text written by aweb server in previous request-response cycles. The information storedby cookies can be used to personalize the experience when using awebsite. A website can use cookies to find out if someone has visited awebsite before and record data about what they did. When someone isusing a computer to browse a website, a personalized cookie datastructure can be sent from the website's server to the person'scomputer. The cookie is stored in the web browser on the person'scomputer. At some time in the future, the person may browse that websiteagain. When the website is found, the person's browser checks whether acookie for that website is found and available. If a cookie is found,then the data that was stored in the cookie before can be used by thewebsite to tell the website about the person's previous activity. Someexamples where cookies are used include shopping carts, automatic login,and remembering which advertisements have already been shown.

Additionally or alternatively, the second request may be generated fromother data received in response to the first request, besides cookies.For example, the other data can include other types of headers,parameters, or the body of the response.

Because many websites require session information, usually stored incookies but possibly received in other data from previously visitedretrieved pages, web scraping system 104 may reproduce a series of HTTPrequests and responses to scrape data from the target website. Forexample, to scrape search results, embodiments described herein mayfirst request the page of the general search page where a human userwould enter her search terms in a text box on an HTML page. If it were ahuman user, when the user navigates to that page, the resulting pagewould likely write a cookie to the user's browser and would present anHTML page with the text box for the user to enter her search terms.Then, the user would enter the search terms in the text box and press a“submit” button on the HTML page presented in a web browser. As aresult, the web browser would execute an HTTP POST or GET operation thatresults in a second HTTP request with the search term and any resultingcookies. According to an embodiment, the system disclosed here wouldreproduce both HTTP requests, using data, such as cookies, otherheaders, parameters or data from the body, received in response to thefirst request to generate the second request.

In embodiments, the system may be able to simulate a request sent from aparticular geographic location. One way to do this is to select a proxyfrom a particular geographic location. However, one issue with this isthat there may not be sufficient proxy IP addresses available in everylocation of interest. As proxy IP addresses become exhausted and areblocked by target websites, the supply of proxy IP addresses, inparticular, geographic locations, may become limited or even exhausted.

Many sites provide another way for a browser to identify a geolocationin the

HTTP request. In those sites, the IP address may not be the only sourceof location information. A browser may have settings and a user profilethat enable a user to allow the browser to send location information.The location information is information describing the location of thedevice sending the HTTP request, for example, a GPS location detected bya GPS receiver on a mobile device. The browser may provide the locationinformation in the HTTP request. In one example, the location may beembedded in header information in the HTTP request such as in a cookie.

The headers can also contain identification of the user agent. Forexample, they can include an identification of a type of browser beingused. In this way, a web server can customize a response based on theuser agent being used to access the content. For example, a site mightlook different on a mobile browser than on a desktop browser. Sometimes,websites may only support certain types of browsers. Browsers might havedifferent features available to them, and when a website recognizes fromthe HTTP header, information that the request came from a browserlacking the necessary features for the website, the site may refuse torespond with the requested page.

According to embodiments, web scraping system 104 can mimic thistransmission of location information without using the actual browser.For example, the system can embed location information in headers of theHTTP requests sent to the target website. In this way, web scrapingsystem 104 may be able to formulate a localized request, even when aproxy IP address located in the desired region may be unavailable.

Further description of how web scraping system 104 may formulate theseries of requests needed to obtain the desired content is providedbelow in FIG. 2 . Once web scraping system 104 formulates an HTTPrequest, it sends the request to a web proxy 106A . . . N.

Web proxy 106A . . . N are each a server that acts as an intermediaryfor requests from clients seeking resources from servers that providethose resources. Web proxy 106A . . . N thus functions on behalf of theclient when requesting service, potentially masking the true origin ofthe request to the resource server.

In FIG. 1 , at least one of web proxy 106A . . . N accepts a requestfrom web scraping system 104. The request is in a proxy protocol format.The at least one web proxy 106A . . . N that accepts the requestforwards the request to target web server 108. In forwarding therequest, the web proxy 106A . . . N assigns its own IP address as thesource IP address for packets encapsulating the HTTP request. Thedestination IP address for any packets encapsulating the HTTP request isthe IP address of target web server 108. Because the source IP addresswas the web proxy 106A . . . N, target web server 108 may not be able todetermine that the request originated from web scraping system 104. Oncetarget web server 108 generates a response to the request, target webserver 108 sends the response back to the web proxy 106A . . . N thatforwarded the request, which in turn forwards the response to webscraping system 104.

Target web server 108 is computer software and underlying hardware thataccepts requests and returns responses via HTTP. As input, target webserver 108 typically takes the path in the HTTP request, any headers inthe HTTP request, and sometimes a body of the HTTP request, and usesthat information to generate content to be returned. The content servedby the HTTP protocol is often formatted as a webpage, such as using HTMLand JavaScript.

FIG. 2 includes a diagram 200 that illustrates an example operation ofsystem 100 in FIG. 1 and provides further description of how componentsof system 100 may interact.

As illustrated in diagram 200, to request that web content to bescraped, client computing device 102 sends a scrape request 202 to webscraping system 104. In response to scrape request 202, web scrapingsystem 104 initiates a series of operations and transactions needed toscrape the results. In diagram 200, the transactions are labeled asmessages 204A-D and 206A-D. After the results are scraped, web scrapingsystem 104 provides the retrieved content back to client computingdevice 102 as scraped results 208.

In an embodiment, web scraping system 104 may cache scraped data. Forexample, when a request to scrape is received from a client, the systemmay determine whether the website targeted has been scraped within acertain time, such as within the last day. If the website has beenscraped recently, e.g., within the certain time period, the system mayreturn the previously scraped results.

Client computing device 102 interacts with web scraping system 104 invarious ways. In an embodiment, a client may send scrape request 202with the parameters describing the web scraping sought to be completed.The request and its parameters may conform to an API set forth by system104. The parameters may include a Uniform Resource Locator (URL),Uniform Resource Identifier (URI), header information, geolocationinformation, and browser information, and other values listed in greaterdetail below with respect to FIG. 3 . In response to the request, system104 will return an acknowledgment that the request is received. Theacknowledgment may include a message indicating that the scraped resultswill be available at a particular location. The system queues therequest and, when the scraped results are retrieved, a message, alsocalled a callback, may be sent to client 102 indicating that scrapedresults 208 are available. In this way, system 104 can asynchronouslyservice a client request for the scrape data.

Alternatively or additionally, client 102 may send the request, asdescribed above, but instead of returning an acknowledgment, system 104may keep the connection with client 102 open while the scraping is beingconducted. Once the scraping is completed, the results are returned in aresponse to the initial request. In this way, system 104 cansynchronously service a client request for the scrape data.

Alternatively or additionally, the request may service requestsformatted according to a proxy protocol. The proxy protocol may be thesame protocol used by proxy server 106 to accept and respond torequests. In diagram 200, such requests are labeled proxy protocolrequest 204A and 206A and proxy protocol responses 204D and 206D.Examples of a proxy protocol include the HTTP proxy protocol and a SOCKSprotocol.

When web scraping system 104 receives scrape request 202, web scrapingsystem 104 determines the necessary transactions needed to scrape therequested content. As mentioned above, because of state variablesexpected from target website 108, to scrape the requested content,multiple transactions with target website 108 may be necessary. In theexample in diagram 200, two transactions are shown, but more or less maybe needed. For each transaction, web scraping system 104 needs todetermine all the parameters for an HTTP request and format the HTTPrequest accordingly.

The logic necessary to determine the series of the transactions andcorresponding

HTTP requests may be preprogrammed for each target website. Whenscraping API request 202 is received, web scraping system 104 looks atthe needed logic and generates the transactions and corresponding HTTPrequest accordingly. In addition, the logic describing the sequence ofHTTP requests to reach a target website may be stored in advance. When acustomer request is received to scrape a target website, the logicnecessary to reach the target website is retrieved and executed,resulting in a series of HTTP requests being sent and HTTP responsesbeing received.

In diagram 200, the HTTP requests to target website 108 are HTTP request204B and HTTP request 206B. As described above, web scraping server 104may not send the requests directly to target website 108 and insteadsend them through at least one intermediary proxy server 106. To sendthe request to proxy server 106, a proxy protocol may be used.

To send a request according to an HTTP proxy protocol, the full URL maybe passed, instead of just the path. Also, credentials may be requiredto access the proxy. All the other fields for an HTTP request must alsobe determined. To reproduce an HTTP request, web scraping system 104will generate all the different components of each request, including amethod, path, a version of the protocol that the request wants toaccess, headers, and the body of the request.

An illustrative example of proxy protocol request 204A is reproducedbelow:

-   GET https://www.searchengine.com/HTTP/1.1-   Proxy-Authorization: Basic encoded-credentials-   Accept: text/html-   User-Agent: Mozilla/5.0-   Cookie: Location=Alexandria, Va., USA;

In the above example, the HTTP method invoked is a GET command, and theversion of the protocol is “HTTP/1.1.” The path is“https://www.searchengine.com/,” and because it includes a full URL asopposed to URI, it may signify to web proxy 106 that the HTTP request isfor a proxy request. The body of the request is empty.

The example HTTP proxy protocol request 204A includes four headers:“Proxy-Authorization,” “Accept,” “User-Agent,” and “Cookie.” The“Proxy-Authorization” header provides authorization credentials forconnecting to a proxy. The “Accept” header provides media type(s) thatis/are acceptable for the response. The “User Agent” header provides auser agent string identifying the user agent. For example, the “UserAgent” header may identify the type of browser and whether or not thebrowser is a mobile or desktop browser. The “Cookie” header is an HTTPcookie previously sent by the server with Set-Cookie (below). In thiscase, the server may be set up to previously have saved the location ofthe user. Thus, if the user had previously visited the server fromAlexandria, Virginia, the server would, for example, save “Alexandria,VA, USA” as a cookie value. By sending such a cookie value with therequest, web scraping system 104 can simulate the geolocation withouthaving previously visited the location and without needing a proxy IPaddress located in Alexandria, Virginia.

System 104 may profile these values, the HTTP headers and the path(e.g., “https://www.searchengine.comr” v.“https://www.searchengine.com/en/”), to resemble requests that would beplausibly generated by a browser controlled by a human. In this way,system 104 may generate the HTTP requests to avoid the target web serverbeing able to detect that the requests are automatically generated froma bot.

The HTTP proxy protocol is one example of how the proxy protocol mayoperate.

In another example, HTTP tunneling may be used, using, for example, theHTTP CONNECT command. In still another example, the proxy may use aSOCKS Internet protocol. While the HTTP proxy protocol operates at theapplication layer of the OSI model protocol stack, SOCKS may operate atthe session layer (layer 5 of the OSI model protocol stack). Otherprotocols may be available forwarding data at different layers of thenetwork protocol stack.

When proxy server 106 receives proxy protocol request 204A, it sends acorresponding HTTP request 204B to target website 108. Continuing theexample above, the target website 108 may be a web server addressed bythe hostname “www.searchengine.com.” In this example, HTTP request 204Bmay be:

-   GET/HTTP/1.1-   Accept: text/html-   User-Agent: Mozilla/5.0-   Cookie: Location=Alexandria, Va., USA;

In response, target website 108 will return an HTTP response with thewebsite located at its path “/”. The website may be customized accordingto the headers, for example, it may be customized according to thelocation information and user agent information in the headers of HTTPrequest 204B.

Continuing the example above, HTTP response 204C may be as follows:

HTTP/1.1 200 OK Content-Type: text/html Set-Cookie: Location=Alexandria,VA, USA; session-id=“1234567890abcdef” <!DOCTYPE html> <body> <h1>SearchQuery</h1>  <form action=“/search”>   <input type=“text” id=“query”name=“query”>   <input type=“submit” value=“Submit”>  </form> </body></html>

In that example, again, HTTP response 204C can include an indication ofthe version of the protocol used (here, “HTTP/1.1”), a status codeindicating if the request is successful or not (here, “200”), a statusmessage with a non-authoritative short description of the status code(here, “OK”). HTTP response 204C can also include headers and a body.

Here, the headers include a “Content-Type” header which includes a MIME

(Multipurpose Internet Mail Extensions) type of this content and a“Set-Cookie” header that sets cookies to be transmitted with the nextrequest to target website 108. In this case, the “Set-Cookie” headerkeeps the geolocation information previously transmitted and adds a“session ID.” Target website 108 may expect the session ID to bereturned to it in further requests. In this way, target website 108 cantrack sessions and maintain the state across multiple request-responsecycles.

The body of HTTP response 204C in the example above is a simple HTMLpage. If the HTML page were rendered in a browser, the browser wouldpresent a form providing a search text box field and a submit button.When the submit button is selected, the browser would submit anotherrequest to the URI “/search” carrying, as is parameter, the input in thetext field.

Target website 108 sends HTTP response 204C to proxy server 106. Inresponse to receipt of HTTP response 204C, proxy server 106 sends aproxy protocol response 204D. Proxy protocol response 204D may beformatted according to the proxy protocol as described above. In anexample, the proxy protocol response 204D may be similar or identical toHTTP response 204C.

On receipt of proxy protocol response 204D, web scraping system 104 thengenerates the next request in the sequence or requests needed toretrieve the requested content. In diagram 200 the next request is proxyprotocol request 206A. Proxy protocol request 206A is generated tosimulate a request that would be generated had a user on a browserentered in the desired search terms in the search field and pressedsubmit.

Continuing the example above, scrape request 202 may instruct webscraping system 104 to scrape search results for the search term“CompanyA.” Moreover, web scraping system 104 will generate proxyprotocol response 206A to include the cookie and session informationprovided from the previous transaction. In that case, proxy protocolresponse 206A may be as follows:

-   GET https://www.searchengine.com/search?query=CompanyA HTTP/1.1-   Proxy-Authorization: Basic encoded-credentials-   Accept: text/html-   User-Agent: Mozilla/5.0-   Cookie: Location=Alexandria, Va., USA; session-id=“1234567890abcdef”

The path specified proxy protocol response 206A includes a complete URLof the destination sought from target website 108. It includes targetwebsite 108's hostname “www.searchengine.com.” It also includes the pathwithin target website 108 that is sought in this case“/search?query=CompanyA.” The first part of the path “/search” isspecified by the submit button in the HTML form included in HTTPresponse 204C. The name of the parameter submitted “query” is alsospecified by the text field element in the HTML form included in HTTPresponse 204C. As described above with respect to proxy protocol request204A and proxy protocol response 204D, this is one example; otherprotocols to establish a proxy relationship may be used.

When proxy server 106 receives proxy protocol request 206A from webscraping system 104, it generates a corresponding HTTP request 206B andsends HTTP request 206B to target website 108. Proxy server 106generates HTTP request 206B in a similar manner to what was describedabove with respect to HTTP request 204B. Continuing the running example,HTTP request 206B sent to target website 108 may be:

-   GET/search?query=CompanyA HTTP/1.1-   Proxy-Authorization: Basic encoded-credentials-   Accept: text/html-   User-Agent: Mozilla/5.0-   Cookie: Location=Alexandria, Va., USA; session-id=“1234567890abcdef”

Based on HTTP request 206B, target website 108 generates HTTP response206C. Target website 108 may generate a page corresponding to the pathrequested, including the parameters included in the path (here,“/search?query=CompanyA”). Commonly, target website 108 will generatesuch a page dynamically checking databases, perhaps runningcomputations, and formatting results accordingly. Continuing the exampleabove, HTTP response 206C may be:

HTTP/1.1 200 OK  Content-Type: text/html  <!DOCTYPE html>  <body> <h1>Search Results</h1>  <p> <ahref=“https://www.companya.com”>CompanyA</a> </p>  <p> <ahref=“https://www.companyb.com”>CompanyB</a> </p>  <p> <ahref=“https://www.companyc.com”>CompanyC</a> </p>  </body>  </html>

Similar to HTTP response 204C, HTTP response 206C includes the protocolversion, a status code, a status message, headers, and a body. The bodyof HTTP response 206C in the example above is a simple HTML page. If theHTML page were rendered in a browser, the browser would present listingof search results, with each search result having a corresponding link.A result “CompanyA” linked to the URL “https://www.companya.com” wouldbe presented first. This HTML page is the content sought to be scrapedby client computing device 102.

Target website 108 returns HTTP response 204C to proxy server 106. Asdescribed above with respect to proxy protocol response 204D, proxyserver 106 generates proxy protocol response 206D based on HTTP response206C. Proxy protocol response 206D includes the scraped content. Proxyserver 106 sends proxy protocol response 206D to web scraping system104.

Based on and in response to proxy protocol response 206D, web scrapingsystem 104 generates and sends scraped results 208 to client computingdevice 102. As described above, web scraping system 104 may send thescraped content, in this case the HTML page within HTTP response 206C,directly to client computing device 102 within the scraped results 208.Alternatively or additionally, web scraping system 104 may parserelevant information from the HTML, page and send the parsed informationto client computing device 102 in scraped results 208.

Components and Operation of an Automated Web Scraping System

FIG. 3 is an architecture diagram illustrating aspects of web scrapingsystem 104 in greater detail. Web scraping system 104 includes a requestintake manager 302, request status manager 304, history archive 306,parser 308, scraper 310, and message queue manager 312. Each of thesecomponents is described in turn.

Request intake manager 302 receives and processes incoming requests fromclient computing device 102. As described above, client computing device102 can provide requests to request intake manager 302 synchronously andasynchronously. Client computing device 102 can provide the requestsusing a specialized API or using a proxy protocol.

The API call may include any of the following values as parameters:

-   -   Data source specifying the target website to retrieve, such as a        particular search engine or e-commerce website;    -   Domain localization specifying the domain name system        localization, which may specify the top level domain name of the        website to request (“.com,” “.fr”, “.de”, etc.);    -   a keyword to search on the search engine or e-commerce site;    -   a number indicating how many results to retrieve from the target        website;    -   for scraped results spanning multiple pages, a starting page        number and number of pages to retrieve, which together specify        the page ranges to scrape;    -   Accept-Language HTTP header value to use, this header value may        signal to the target website the language to return results in;    -   a geographical location to mimic when making the request;    -   a device type and browser to mimic when making the request;    -   a flag to signal whether web scraper system 104 should parse the        HTTP response; and    -   a flag to signal whether web scraper system 104 should signal to        the target website to AutoCorrect spelling;    -   a flag to signal whether web scraper system 104 should signal in        its cookies to use    -   a particular results language;    -   any other parameters that might be expected by a target website,        such as sorting and filtering methods to be used in conducting        the search; and    -   user credentials, such as username/password or a token.

In addition to the above parameters, when the API request is a callbackrequest, the API request provided to request intake manager 302 mayinclude a network location (such as a URL) for web scraping system 104to provide the callback message when the scraping request has beencompleted and results are available.

Request intake manager 302 may be configured to take parameters inmultiple different formats and may be configured to accept requestsusing multiple different parameter names. In that embodiment, requestintake manager 302 may normalize the different formats and parameternames into a common format before further processing. When requestintake manager 302 accepts such a different format from a clientcomputing device, it may remember that the client computing device usedthat different format and translate any results returned into a formatexpected by the client computing device.

When request intake manager 302 receives an API request, request intakemanager 302 may first validate the request to ensure that the APIrequest conforms to a format that is understood by web scraping system104 and that the parameters for the API request specify web scraping canbe executed by web scraping system 104. When request intake manager 302confirms that an API request is valid, request intake manager 302 maysend the API request to request status manager 304 to manage processingof the request.

For an asynchronous API request, request status manager 304 may returnto request intake manager 302 a job identifier that client computingdevice 102 may later use to retrieve the results of the request. Requestintake manager 302 may then send that job identifier to the clientcomputing device 102 for storage and later use when the request iscompleted.

For a synchronous API request, request status manager 304 may hold theconnection with client computing device 102 open until web scrapingsystem 104 completes the scraping requests and results are available.When results are available, request status manager 304 will respond tothe API request with the scraped results, closing the connection.

Once request intake manager 302 sends the API request to request statusmanager 304, request status manager 304 manages processing of therequest. Request status manager 304 may save the job description and anyreturn results corresponding to the job description in job database 314.As will be discussed below with respect to FIG. 4 , request statusmanager 304 may include a plurality of servers that operateindependently of one another. In particular, the plurality of serversmay not know about each other and may not communicate any state to oneanother.

As will be described in detail below with respect to FIG. 4 , requeststatus manager 304 and request intake manager 302 work together to savea description of the job to be processed and an indication of the jobstatus in job database 314.

Once the job description and job status are saved in job database 314,request status manager 304 sends the job description to central messagequeue 312. Central message queue 312 may be a message broker softwareapplication. A message broker software application is an intermediarycomputer program module that translates a message from a formalmessaging protocol of the sender to a formal messaging protocol of thereceiver. In different examples, the messaging protocols can include theAdvanced Message Queuing Protocol (AMQP), Streaming Text OrientedMessaging Protocol (STOMP), and MQ Telemetry Transport (MQTT). Centralmessage queue 312 provides communication among components of webscraping system 104, including request status manager 304, historyarchive 306, parser 308, and scraper 310. By mediating communicationamong the various components, central message queue 312 minimizes themutual awareness that the various components need one another. Thisencourages decoupling of the components.

Central message queue 312 may include a first-in-first-out queue for jobdescriptions. Scraper 310 may monitor central message queue 312, takingjobs off the central message queue 312 and conducting the scraping fromtarget website 108 accordingly. As mentioned above, some jobs mayrepresent a synchronous API request while others may be asynchronous.Scraper 310 may prioritize the synchronous jobs above the asynchronousjobs to help ensure that results are determined before web scrapingsystem 104's connection with the client computing device 102 times out.

As described above, based on the job description retrieved from centralmessage queue 312, scraper 310 may formulate a series of HTTP requestsfrom target website 108 to ultimately retrieve results as specified inthe request, such as a desired HTML page.

Once scraper 310 has retrieved the results, scraper 310 may place theretrieved HTML along with an identification of the job on to centralmessage queue 312. Request status manager 304 may retrieve the resultsfrom central message queue 312 and placement job database 314.Alternatively or additionally, scraper 310 may send the results directlyback to request status manager 304, which places the results in jobdatabase 314 and sends a link to the results as will be described belowwith respect to FIG. 4 .

If the API request was strictly requesting HTML, request intake manager302 may then return the scraped HTML to the user. As described above, ifthe request from client computing device 102 is synchronous, requestintake manager 302 may send the scraped HTML to client computing device102 in response to the request. Alternatively, if the request isasynchronous, request intake manager 302 may send a notification toclient computing device 102 that the results are available and clientcomputing device 102 may retrieve the scraped HTML from job database 314via request intake manager 302.

As mentioned above, alternatively or additionally to the HTML results,client computing device 102 may request parsed results. Parsing of thescraped HTML may be executed by parser 308. Parser 308 may analyze thescraped HTML file and may extract relevant fields from the HTML file. Toanalyze the HTML file, parser 308 may use a known format or patternswithin the HTML file (such as the Document Object Model) to identifywhere the relevant fields are located. With the relevant fieldsextracted, parser 308 may insert the extracted fields into a new datastructure, such as a file. In an example, the new file may be aJavaScript Object Notation (JSON) format, which is a standard datainterchange format. The resulting file with the parsed data may bestored in job database 314 and returned to client computing device 102.

Retrieved results may also be stored to history archive 306. Historyarchive 306 is an archival, or cold database service. History archive306 stores the scraped data for longer than job database 314. It is notmeant to represent current content from a target website, insteadrepresenting historical content. While job database 314 may eraseresults after a certain time period, such as 24 hours, history archive306 may store results indefinitely. In one embodiment, history archive306 may store parsed scraped data but not HTML, data because HTML, datahas structure and formatting that may not be relevant to a client. Whenthe parsed data is stored, the job description may be also stored andused as metadata in an index to allow the parsed data to be searched. Inthe event that a client makes an identical request twice, the resultsmay only be stored in history archive 306 if the results from the firstrequest are older than a certain age, such as one month.

FIG. 4 is an architecture diagram showing components of web scrapingsystem 104 in greater detail.

As mentioned above, request status manager 304 includes a plurality ofdatabase servers 404A . . . N that operate independently of each other.In particular, the plurality of servers may not know about each otherand may not communicate any state to one another.

In an embodiment, each of the plurality of servers 404A-N may bereferred to as a database shard. A database shard, or simply a shard, isa horizontal partition of data in a database or search engine. Eachshard is held on a separate database server instance, to spread load.Some data within a database may remain present in all shards, but someappears only in a single shard. Each shard acts as the single source forthis subset of data. Horizontal partitioning is a database designprinciple whereby rows of a database table are held separately, ratherthan being split into columns (which is what normalization and verticalpartitioning do, to differing extents). Each partition forms part of ashard, which may in turn be located on a separate database server orphysical location.

Horizontal partitioning may be advantageous because tables are dividedand distributed across multiple servers. Since the tables are dividedand distributed into multiple servers, the total number of rows in eachtable in each database is reduced. This reduces index size, which mayimprove search or query performance of the database. Also, a databaseshard can be placed on separate hardware, and multiple shards can beplaced on multiple machines. This enables a distribution of the databaseover a large number of machines, improving performance.

In another embodiment, instead of independent database servers, databaseclustering may be used to spread functionality across multiple serversor machines. With database clustering, the various servers must be awareof each other. With database clustering, the database may not behorizontally partitioned across the multiple servers. However, withclustering, the state may need to be synchronized between the variousservers. For example, two servers may not be able to update the same rowat the same time. While this may have advantages in avoiding the need topartition rows of the database, synchronizing state and avoidingcollisions, it may slow performance.

Because the plurality of servers operate independently of one another,request intake manager 302 may need to decide which of the plurality ofservers to use and remember which server is processing each job toensure that information relating to the job, such as scraped results, issent to the proper server. That is, the database instance that isresponsible for managing the API request. Moreover, to realizeperformance advantages, request status manager 304 may be able todetermine how the data is segmented across the multiple shards, thusavoiding the need to query every shard to determine a jobs status orretrieve job information, such as scraped results.

In one embodiment, a job identifier encodes an identification of theshard that is servicing a web scraping request. The job identifier issent to a client computing device when the request is created. And, whenthe client computing device seeks to retrieve status information orresults for a previous request, the client computing device may use thejob identifier it received for that previous request. Request statusmanager 304 may be able to decode the job identifier to determine whichshard is handling the request.

In-memory job table 452 may be used to store and retrieve statusinformation. The in-memory job table 452 may be stored in a volatile(but also non-transitory) memory. Because the memory is volatile, datamay be lost if power is disconnected. But volatile memory may, ingeneral, have faster retrieval times than persistent memory. By storingthe mapping table in memory, embodiments may provide faster accesstimes. To store job information, each scraping job needs a unique jobidentification number. In particular, the job identification numberneeds to be unique across all the database shards.

To access in-memory job table 452 (both reading and writing), requestintake manager 302 may send a request to in-memory access server 450.In-memory access server 450 may act as a database server that controlsand allows access (and perhaps performs other memory managementfunctions) for in-memory job table 452.

Similar to how request status manager 304 includes multiple serversoperating independently of one another, request intake manager 302 mayalso include multiple servers operating independently of one another. InFIG. 4 , these multiple servers are illustrated as API receivers 402A .. . N. Each of API receivers 402A . . . N may perform the functionsdescribed above for request intake manager 302, including receiving anAPI request from client computing device 102, validating the APIrequest, sending information describing the scraping job to requeststatus manager 304, and (for a call back request) returning to clientcomputing device 102 data necessary to retrieve the scraped results whenthey are available.

Having multiple API receivers 402A . . . N allows the receivers tospread service

API requests in parallel and spread computing load across multiplecomputing resources and machines. Yet, having multiple API receivers402A . . . N operating independently without sharing state or beingaware that other API receivers exist may add complexity in coordinatingfunctionality.

For example, because both the request intake manager 302 and requeststatus manager 304 include multiple servers operating independently ofone another, they may not be aware of job identification numbers thathave already been assigned. This can lead to difficulties in determininga unique job identification number associated with a new scraping job.

To determine a job identification number, an API receiver 402A . . . Nmay first determine to which of the plurality of database servers 404A .. . N to send the scraping job. That determination is described ingreater detail with respect to FIGS. 10-11 . API receivers 402A . . . Nmay then retrieve a next value from a counter maintained by eachrespective database servers 404A . . . N. The counter may reset at everytime interval, such as every millisecond. API receiver 402A . . . N mayconcatenate an identification of database servers 404A . . . N with atimestamp and the next value retrieved from in-memory access server 450.In this way, API receiver 402A . . . N may generate a unique jobidentifier.

In addition to generating the unique job identifier, on receipt of anAPI request from client computing device 102, API receivers 402A . . . Nmay validate all the parameters received from client computing device102, convert them into a format for internal processing by requeststatus manager 304, and send the converted and validated parametersalong with the unique job identifier (together referred to as a jobdescription) to the selected database server 404A . . . N.

In particular, the API receivers 402A . . . N may send the jobdescription to a message queue 454 implemented within the selecteddatabase server 404A . . . N. Once the job description is placed intothe appropriate message queue 454, the API receiver may (in the case ofan asynchronous request) return the job description to client computingdevice 102 along with other links on how to retrieve status and how toretrieve results. At that point, for an asynchronous request, APIreceivers 402A . . . N will close the connection with client computingdevice 102. For a synchronous request, the connection with computingdevice 102 will stay open until results are available.

Message queue 454 may be a first-in-first-out queue. It may beimplemented as a message broker as described above with respect tocentral message queue 312. Database micro service 456 may be monitoringmessage queue 454. Database micro service 456 may periodically orintermittently retrieve a next queued job description from message queue454 and place the job description and an indication of the job's status(such as “pending”) in job database 458. In addition, either by databasemicro service 456 or another component, the job description and statusmay be cached at in-memory job table 452.

According to an embodiment, a client computing device 102 may want toinquire of system 104 a job's status. In some applications, clientcomputing device 102 may frequently send system 104 new scraping jobsand frequently ask system 104 of the status of previously sent scrapingjobs while they are still in progress. The status requests can quicklyadd up.

To deal with such requests, when a client tries to retrieve status of ajob, the request from client computing device 102 may be sent toin-memory access server 450 (via request intake manager 302), whichretrieves the status information from in-memory job table 452. Bycaching the status information in job table 452 and using the cachedinformation to service client requests for status, embodiments mayrelieve job database 314 from performing that task, improving overallperformance. Also, the status information may be retrieved more quicklyfrom in-memory job table 452 than from job database 314, improvinglatency and processing the client request for a scraping job's currentstatus.

Once the job description and job status are saved in job database 314,request status manager 304 sends the job description to central messagequeue 312. In particular, database micro service 456 places the jobdescription again on message queue 454 implemented in the previouslyselected database server 404A-N. From message queue 454, the jobdescription is forwarded to central message queue 312.

As described above, scraper 310 retrieves and executes the job fromcentral message queue 312. Scraper 310 retrieves the results and entersthem into a message queue 468 that is local to scraper 310. Scraper 310includes a plurality of target scrapers 466A . . . N. Each of the targetscrapers 466A . . . N is configured to scrape a particular targetwebsite. For example, target scraper 466A may include instructions togenerate a series of HTTP requests to scrape search results from aparticular search engine; target scraper 466B may include instructionsto generate a series of HTTP requests to scrape search results from aparticular e-commerce site; etc. One or more of the target scrapers 466A. . . N may be generic, meaning that they are configured to scrape anywebsite, but are not particularly adapted to the sessions expected of aparticular site. Based on the job description (and the customer APIrequest upon which it is based), one of the target scrapers 466A . . . Nis selected to generate and transmit the HTTP requests to a proxy server106.

As discussed above, to generate the HTTP requests so that they appearorganic (that is, appear to be generated from a user's browser and notfrom a bot), various determinations must be made. First, the proxy to beused must be selected. This selection may be done by proxy rotator 486.The selected target scraper 466A . . . N may request an appropriateproxy from proxy rotator 486. Second, the selected target scraper 466A .. . N must determine the appropriate headers to use in the HTTP request,including any cookies needed. Third, selected target scraper 466A . . .N must generate the path for the HTTP request itself

Proxy rotator 486 determines the appropriate proxy to which to send therequest.

Proxy rotator 486 may track which proxies are available to use and whichhave been blocked. For example, proxy rotator 486 may track whatresponses a target website has previously returned to the proxy inresponse to previous requests from scraper 310. To track thisinformation, scraper 310 may report to rotator 486 the status of therequest through the proxy, as rotator 486 may not monitor theconnections between the proxies and scrapers. If a response was an erroror timeout, proxy rotator 486 may identify that proxy is blocked by thattarget website. Moreover, proxy rotator 486 may track which proxies havebeen used recently or heavily. When a proxy has been used recently orheavily, proxy rotator 486 may select a different proxy to allow therecently or heavily used proxy to cool down, extending its life before atarget website might block it.

As mentioned above for FIG. 2 , the selected target scraper 466A . . . Nmay determine many of the headers based on the user parameters from theAPI, which are saved in the job description that the selected targetscraper 466A . . . N receives from central message queue 312. Theseheaders include the user agent to specify the request, such as aparticular desktop or mobile browser. If the API request does notspecify a particular user agent, the selected target scraper 466A . . .N may select a user agent to specify from a predetermined list. Asdiscussed above with respect to FIG. 2 , cookies may require that theselected target scraper 466A . . . N make multiple successive requeststo a target website to get the needed session information.

Finally, the selected target scraper 466A . . . N may determine a pathof the HTTP request. Depending on how the client provided its scrapingAPI request, the client may have specified the full URL to scrape or theclient may have merely provided parameters for scraping. If the clientprovided the full URL, the full URL path may be used. Alternatively, ifthe client merely provided parameters, the parameters may beincorporated into a path in the format expected by a target website. Asmentioned above, a client can specify a geolocation to spoof in therequest. The geolocation may specify certain parameters that theselected target scraper 466A . . . N includes in the path. Even if theclient specifies the full URL, the selected target scraper 466A . . . Nmay need to modify the URL or URI to impersonate that location.

With the HTTP request(s) generated, the selected target scraper 466A . .. N sends the request to a proxy and retrieves the results from thetarget website via the proxy as discussed above with respect to FIG. 2 .The resulting page typically includes HTML. The HTML may include linksto other objects, such as images and widgets to display and interactwith things like geographic maps (perhaps retrieved from a third partyweb service). In addition, the HTML may include JavaScript that has somefunctionality requiring execution to render. In some cases, a client maybe interested in aspects of the page not represented in the HTML. Inthis case, the selected target scraper 466A . . . N may interact with aheadless web browser (not shown) that has the necessary functionality toexecute the JavaScript and retrieve any objects linked within the HTML.In this way, the headless web browser can develop a full rendering ofthe scraped webpage, or at least retrieve the information that would beneeded to develop the full rendering.

When the selected target scraper 466A . . . N sends the request to aproxy, an error could occur making the scraper unable to retrieve theresults. For example, the selected target scraper 466A . . . N mayrecognize the response received from the proxy as incomplete, blockedwith errors (such as an error status code in the HTTP response), or ashaving other problems. Depending on the type of error, the selectedtarget scraper 466A . . . N may try to retrieve results again. In thatcase, the selected target scraper 466A . . . N will place the jobdescription as a new message back on central message queue 312. Whenscraper 310 extracts that message from central message queue 312,scraper 310 will try to generate a new HTTP request. In generating thenew HTTP request, proxy rotator 486 will determine a new proxy to whichto send the new HTTP request, increasing the likelihood that the targetwebsite will service the new request and return the desired results.

When the results are returned, target scraper places the results onmessage queue 468. From there, the results are forwarded to messagequeue 454. Database microservice 456 retrieves the results from messagequeue 454. Then, database microservice 456 stores the results in jobdatabase 314.

As mentioned above, the message forwarded from message queue 454 todatabase microservice 456 may not include the actual HTML scraped.Instead, scraper 466 places the HTML in an HTML cache 462. HTML cache462 may be a distributed memory-caching system. Instead of storing theHTML in any message queue, the HTML may be stored in HTML cache 462 andthe message queued and transmitted to database microservice 456 may be alink to HTML cache 462. When database microservice 456 receives amessage indicating that results have been retrieved, databasemicroservice 456 uses the link to retrieve the results from HTML cache462.

Bypassing message queues in this way may be advantageous because havinga large amount of HTML within a message may slow down operation of amessage queue, such as message queue 454. This is because performance ofmessage broker software applications tends to be sensitive to the sizeof the messages being sent.

With the results returned to database microservice 456, the job statusentry of job database 314 needs to be updated to reflect the job's“completed” status. The job status entry of in-memory job table 452 maynow be out-of-date and, as a consequence, the entry for the job inin-memory job table 452 may be removed, for example, by databasemicroservice 456. With the entry removed, if a client is requesting thejob status, the next time a status request is received, the results maybe retrieved directly from job database 314.

Additionally or alternatively, database microservice 456 may send amessage with a job identifier and with an indication that thecorresponding job has been completed to central message queue 312. Thatmessage may be picked up by notifier 460 which attempts to contact theclient, perhaps at the URL they provided with the initial request, witha callback message indicating that results are available for thescraping request. The callback message may include a URL where theresults can be retrieved.

As mentioned above, in addition to HTML, client computing device 102 mayrequest parsed data, which can be generated by parser 308. In thatembodiment, before database microservice 456 changes the job status tocomplete in job database 314 and sends a message to notifier 460 to sendthe callback message, database microservice 456 will send a message withthe HTML via message queue 454 to parser 308. In an alternativeembodiment, instead of sending the message with the HTML via messagequeue 454 to parser 308, the message will be sent with a link to theHTML file in HTML cache 462. When the message is received at parser 308,parser 308 can retrieve the HTML file from HTML cache 462 using the linkwithin the message. Avoiding sending a large HTML file via messagebrokers, including message queue 454, may have speed benefits asdescribed above. Alternatively or additionally, parser 308 can consume amessage linking to results in HTML cache 462 directly from centralmessage queue 312, avoiding message queue 454.

Parser 308 conducts the parsing, generates the parsed data file andreturns the parsed data file back to database microservice 456, whichstores the parsed data file in job database 314. Only then, after theparsed data is stored in job database 314, does database microservice456 update the job completion status and job database 314 and send amessage to notifier 460 to send the callback message.

Also, as mentioned above, client computing device 102 can request thatresults be written to a particular external database belonging to theclient, the external database may be a cloud storage database such as anS3 database available from Amazon.com, Inc. of Seattle Wash. In thatembodiment, database microservice 456 may send the results to externaldatabase writer 464, which sends the results to the external databasethat the client had specified. In that case, the callback is sent afterdatabase writer 464 completes its job. The completion confirmation issent via central message queue 312 and forwarded to message queue 454where it is consumed by database microservice 456 for transmission ofthe callback message to the client.

Throttling Web Scraping Requests

FIG. 5 illustrates a web scraping system 104 with a throttler 502. Insome cases, client computing device 102 may send a large number ofrequests for web scraping to web scraping system 104 in a short amountof time. The client may not want to stagger requests or may not know howto stagger requests into web scraping system 104. Instead, the clientmay prefer to send all the scraping job requests to web scraping system104 at substantially the same time.

As mentioned above, scraper 310 may have a limited number of resources,including available proxies that can execute the requests. Those proxiesbecome depleted with time or with enough concurrent requests as targetwebsites begin to recognize that the requests originating from a proxyare automated and start to block incoming requests from the proxy. Iftoo many proxies are depleted, scraper 310 may be unable to scrape data,effectively disabling web scraping system 104.

While the client may prefer to send a large number of the scraping jobrequests to web scraping system 104 within a short time interval, theclient may not care whether the results are returned immediately or overthe course of an extended time period.

Throttler 502 enables web scraping system 104 to accept a large numberof requests, but stagger when they are executed. Operation of throttler502 is described in greater detail with respect to FIGS. 6 and 7 .

FIG. 6 shows a timeline 600 illustrating how web requests can bethrottled and trickled out over time. Timeline 600 illustrates how aplurality of web scraping requests 610A-E are received during a timeperiod 602. As described above, each of the plurality of web scrapingrequests specifies a target website from which to capture content. Andbased on the incoming requests, job descriptions describing the webscraping job described by the request are generated. The descriptionsare placed on a queue.

The job descriptions are removed from the queue over a time period 604.Time period 604 is longer than time period 602. The job descriptions maybe removed incrementally over a repeating, fixed interval 606. The jobdescription corresponding to API request 610A is removed at time 612A;the job description corresponding to API request 610B is removed at time612B; the job description corresponding to API request 610C is removedat time 612C; the job description corresponding to API request 610D isremoved at time 612D; and the job description corresponding to APIrequest 610E is removed at time 612E. When each respective jobdescription is removed from the queue, a web request for the targetwebsite as specified in the job description is generated. The generatedweb request is transmitted to the target website for processing.

Alternatively or additionally, the interval 606 may be variable.Alternatively or additionally, the requests may be removednon-sequentially (that is, out of order). For example, there can beprioritized queuing. In another example, a scraper can remove a jobdescription lower ranked in the queue while another scraper is stillprocessing a higher ranked job description.

As described above, the generated web request may be transmitted to thetarget website such that the web request reaches the target website viaa proxy selected from a group of proxies. According to an embodiment,the interval 606 may be selected to avoid the group of proxies frombecoming blocked by the target website. In response to the web request,the content transmitted from the target website is received via theselected proxy. And the received content is transmitted to the clientcomputing device.

More details on how the requests can be throttled are illustrated inFIG. 7 . FIG. 7 is a system diagram 700 illustrating how the throttlingmechanism can be implemented within web scraping system 104.

As described above, a request intake manager 302 is configured toreceive a plurality of web scraping requests from a client computingdevice 102 (not shown in FIG. 7 ). Those API requests are sent torequest status manager 304. Request status manager 304 may evaluate eachAPI request and compare the request to parameters stored in throttleconfiguration database 714.

Throttle configuration database 714 stores information about whichrequests should be throttled. This may be set up on a per-client basisbased on the level of service to which they have subscribed. Forexample, a client purchasing a higher level of service may experienceless or no throttling, web scraping system 104 accepting that proxiesmay be depleted more quickly when servicing that customer's requests.Conversely, a client purchasing a lower level of service may opt formore throttling as they may not need results as quickly or may prefer tosend a large number of requests within a short time period withoutrequiring them all to be serviced immediately.

The parameters stored in throttle configuration database 714 may includeaspects of the API request that are needed to define whether or not theAPI request should be throttled and how the API request should bethrottled. For example, throttle configuration database 714 may have anentry for a particular client, target, and whether or not the APIrequest is requesting that the web request be done from a headlessbrowser.

Request status manager 304 may compare the API request to the parametersstored in throttle configuration database 714 and, based on that, maysend the corresponding job description and a command 710 to a queueselector 716. Command 710 may indicate whether or not a web requestdescribed by the respective job description should be throttled.

Based on the command 710, queue selector 716 sends the respective jobdescription to either throttler 502 or central message queue 312. Whencommand 710 indicates that the request should not be throttled, queueselector 716 may send the job description to central message queue 312,where it is picked up and processed by scraper 310 as described above.

When command 710 indicates the request should be throttled, queueselector 716 sends the job description to throttler 502. Throttler 502includes a plurality of throttle queues 702A . . . N. Throttler 502 mayselect from the plurality of throttle queues 702A . . . N depending onaspects of the job description. In an embodiment, each job descriptionmay include a client identifier indicating a client from which therequest originates. Queue selector 716 may select the queue for the jobdescription from a plurality of queues 702A . . . N based on the clientidentifier. Additionally or alternatively, each job description mayinclude an identifier of the target website. Queue selector 716 mayselect the queue for the job description from a plurality of queues 702A. . . N based on the target website.

Additionally or alternatively, queue selector 716 may select the queuefor the job description from a plurality of queues 702A . . . N based onwhether the job description specifies that web scraping be made from aheadless browser. As described above, when the job description requeststhat web scraping be made with the headless browser, further requestsare made to retrieve content that would be needed to render the targetweb page. For example, when a web page HTML is received from the targetwebsite, the content is analyzed to determine web addresses foradditional content needed to render the web page and the additionalcontent from the web addresses.

Jobs are removed from the respective throttle queues 702A . . . N by ajob remover 704. Job remover 704 is configured to remove jobdescriptions incrementally. Each of the throttle queues 702A . . . N mayhave an associated time window that job remover 704 waits between jobdescriptions. The associated time window may be stored in throttleconfiguration database 714 and may correspond to a level of service towhich the client has subscribed . In addition, throttle configurationdatabase 714 may have a number of job descriptions that should beremoved from the respective throttle queue 702A . . . N during each timeincrement. For example, according to the specification in throttleconfiguration database 714, job remover 704 may remove five jobdescriptions from throttle queue 702A every 20 seconds.

When job remover 704 removes a job description from throttle queues 702A. . . N, job remover 704 provides the job description to queue selector716 along with a command 712 indicating that throttling is no longernecessary and that the job should be processed. Based on command 712,queue selector 716 forwards the job description to central message queue312 where it is processed by scraper 310 as described above.

As mentioned above, throttling functionality is specified in throttleconfiguration database 714 according to a level of service requested bythe customer. Based on the level of service, throttling may no longer beneeded. When web scraping system 104 determines that web scrapingrequests from the client computing device no longer need to bethrottled, system 104 may first determine when the queue is empty. Onlywhen the queue is determined to be empty does web scraping system 104delete the queue.

Traffic Counting for Proxy Web Scraping

Traditionally, proxy web scraping services may have tracked useractivity on a per request basis for invoicing purposes. According toembodiments, user activity for proxy web based scraping services istracked on a traffic basis. In particular, when a response is receivedto a web scraping traffic total, the amount of data transferred over aphysical network layer may be calculated. To calculate the amount ofdata, an adjustment may be made to the total amount of data received toaccount for compression that occurs when the data is transferred. Inaddition, the amount of data may exclude requests and responses neededto acquire session information to request the scraped traffic.

FIG. 8 is a system diagram illustrating how traffic counting can beimplemented in a web scraping system. FIG. 8 illustrates that webscraping system 104 includes a traffic counter 802, traffic countdatabase 806 and invoice generator 808.

Traffic counter 802 is configured to track the amount of trafficreceived and/or sent by scraper 310 and store the data in traffic countdatabase 806. Traffic counter 802 may count data from content and maycount data from requests.

When web scraping system 104 receives new client requests from a clientcomputing device 102, request intake manager 302 has a limit checker 804that checks whether the current amount of data that a client requests toscrape in a particular time exceeds a maximum threshold, which can beset based on a service level of the client. If it has exceeded a maximumthreshold, request intake manager 302 may refuse to service the request.

Invoice generator 808 generates an invoice based on traffic counts intraffic count database 806. In addition, invoice generator 808 can serveas an interface to enable a client to get the amount of remaining datain his periodic (e.g. monthly) usage plan. For example, invoicegenerator 808 can receive a request from a client, determine an amountof data remaining as a difference between the current traffic total anda maximum allowable for the client, and return the amount of dataremaining to the client.

FIG. 9 is a flowchart illustrating a method 900 for counting andregulating traffic in a web scraping system 104.

Method 900 begins with receipt of a web scraping request at step 902. Asdescribed above this receipt may occur at request intake manager 302 andthe web scraping request may be from a client computing device, such asclient computing device 102. The web scraping request is formattedaccording to an API understood by web scraping system 104 and may targeta website. The API request may also specify the client making therequest.

At step 904, limit checker 804 determines whether a current traffictotal representing the amount of traffic tracked for particular clientduring the time window (such as monthly) exceeds a maximum allowable forthe client. For example, limit checker 804 may check traffic countdatabase 806 to determine the maximum allowable for the client. Thischeck may occur in response to a request, repeatedly or intermittently.The maximum allowable may be set based on the level of service to whichthe client subscribes. Moreover, as will be described below, the maximumallowed may be specific, not just to a client but also to a scraper thatthe web scraping request received from the client computing deviceinvokes. In that situation, traffic count database 806 tracks not justthe current traffic level for the client but also the current trafficlevel for a particular scraper used by the client. Limit checker 804determines whether the current traffic level for the scraper used by theclient exceeds the maximum threshold.

When traffic count database 806 determines that the current trafficlevel exceeds a maximum threshold for the time period, the operationproceeds to step 906, where request intake manager 302 refuses toprocess the request. When traffic count database 806 determines that thecurrent traffic level does not exceed the maximum threshold for the timeperiod, the operation proceeds to step 908.

At step 908, scraper 310 selects a scraper from a plurality of scrapers466A . . . N based on the target website such that the selected scraperincludes instructions on how to generate the web request to extract datafrom the target website. As described above, each of the plurality ofscrapers 466A . . . N include instructions on how to generate one ormore HTTP requests from the target websites to be scraped. Theinstructions specified by the scraper are executed in steps 910 and 912.

At step 910, any preliminary requests specified by the scraper selectedin step 908 are conducted. As described above with respect to FIG. 2 ,to reach the ultimate target website, preliminary requests and responsesmay need to be conducted to get cookies expected by the target website.These requests are made from a proxy selected from a group of proxies.In different embodiments, these requests and responses may be countedtowards the traffic total for a client and scraper. Alternatively, theymay be excluded.

At step 912, the HTTP web request is made to capture the target websitethat the user sought to scrape. The request is generated as specified inthe scraper and transmitted to the target website via the proxy. Via theproxy, content is received from the target website. The size of therequest and response is counted towards the total for a client of theclient computing device, the size of this content is counted toward thetraffic total.

At step 914, additional content may be requested if the web API requestis for a headless browser. As described above, and in that situation, anadditional request may be made to retrieve content that would be neededto render the scraped page. In an embodiment, these additional requestsand responses may also be counted toward the traffic total.Alternatively, they may be excluded.

As described above, many websites are trying to block automatedrequests. At step 916, a determination may be made whether the requestmade in steps 910-914 was successful. If it was not successful, then thedata counts for that request and response may not be excluded from thetotal. A new proxy is selected at step 918, and the operation passesback to step 910 to repeat steps 910-916 until the request issuccessfully processed. In this way, when the target website isdetermined to have refused to serve the web request from the proxy, webscraping system 104 repeatedly attempts to re-send the web request tothe target website via a different proxy. When the request is successfulat step 916, the operation passes to step 920.

At step 920, the amount of data in the requests and responses in steps910-916 as compressed for transmission over a network is determined. Thedetermination may be made based on the compression level that would beused to transmit at a lower layer, such as the network, data link, orphysical layer of the network.

To conduct that determination, an estimated compression level may bedetermined. In particular, a type of data represented by the receivedcontent may be determined. As described above with respect to FIG. 2 ,this type of data may be described, for example, in the HTTP headers.Based on the type of data, a compression factor representing an amountof compression expected when the type of data is transmitted over anetwork is determined. That determination may be made, for example, bylooking up in a table a benchmark compression ratio for data of thattype. Based on that compression factor, the amount of data in thereceived content as compressed for transmission is determined.

At step 922, the compressed count is included in a total amount of datafor the client/scraper. Then, when new requests come in, the process 900is repeated. If the total amount of data has exceeded the threshold at904, the request is refused at 906.

Shards Disabling

As described above, a plurality of database servers 404A . . . N, forexample shards, are used to access job database 314. Sometimes, at leastone of the plurality of database servers 404A . . . N should bedisabled, avoiding further jobs sent to the disabled server. Forexample, a database server may stop performing at all (for example, theprocess may be hung up or have crashed), it may stop performing wellenough, or it may be overloaded and should not receive any more jobsuntil it frees up. How database servers 404A . . . N can be disabled isdescribed with respect to FIGS. 10-11 .

FIG. 10 illustrates operation of various components of web scrapingsystem 104 to detect whether respective database servers 404A . . . Nshould be enabled or disabled.

As described above, each respective database server 404A . . . N has amessage queue 454. As described above, message queue 454 is a messagebroker that queues job descriptions for consumption by databasemicroservice 456. When database microservice 456 consumes a message frommessage queue 454, database microservice 456 places the job descriptionin job database 314 with a “pending” status, initiating processing ofthe job.

Request intake manager 302 repeatedly checks the health each of aplurality of database servers 404A . . . N to determine whether they areavailable to accept new jobs. In various embodiments, the health checksmay be periodic or intermittent. Based on the health checks, requestintake manager 302 determines whether each of a plurality of databaseservers are to be enabled or disabled in a table 1008. Table 1008 may bestored in a non-persistent memory to increase access speed.

To check the health of a respective server from the database servers404A . . . N, request intake manager 302 can repeatedly send variousmessages to check whether the respective database server is operationalin different embodiments. Message 1002 checks the connection betweenrequest intake manager 302 (which is a server that receives web scrapingrequests from client computing devices) and message queue 454 (therespective database server's message broker). If the connection isnonresponsive or returns an error message, request intake manager 302may mark the respective database server as disabled in table 1008.

Message 1004 checks a number of job descriptions (and possibly othermessages used in the scraping process) queued in message queue 454. Ifthe number of job descriptions (and possibly other messages) exceeds athreshold, request intake manager 302 may mark the respective databaseserver as disabled in table 1008.

Message 1006 checks a connection to jobs database 314. Request intakemanager 302 may try to connect to jobs database 314. If the connectionis nonresponsive or returns an error message, request intake manager 302may mark the respective database server as

Atty. Dkt. No. 4835.0030008 disabled in table 1008. If request intakemanager 302 can connect to jobs database 314, Request intake manager 302can infer that database microservice can as well.

In addition to a binary enable or disable status, request intake manager302 may, depending on the results of messages 1002-1006, mark featuresof database servers 404A . . . N as enabled or disabled in table 1008.For example, request intake manager 302 may label a database server asread-only, when it is overworked or hung-up, but is capable of providingread access. And, request intake manager 302 may label a database serveras shutdown, when even read-only access is not available.

FIG. 11 shows how request intake manager 302 uses database server statustable 1008 to determine which database servers 404A . . . N to use toservice an API request from client computing device 102.

Request intake manager 302 includes a database server selector 1100that, when a web scraping request is received from a client computingdevice, selects one of the database servers identified as enabled in thetable. After the selection is made, request intake manager 302 sends ajob description specified by the web scraping request to the selecteddatabase server for storage in the job database as a pending webscraping job.

Request intake manager 302 can also evaluate table 1008 to determinewhether a number of database servers that are disabled in the pluralityof database servers exceeds a threshold. When the number of databaseservers that are disabled exceeds the threshold, request intake manager302 may alert an administrator.

Direct Data Center Request Relating to a Web Scraping Job

Web scraping system 104 may be distributed over a large number ofcomputing devices. The computing devices may be geographicallydisparate. As described above, the job database 314 may be horizontallypartitioned over a large number of database shards. At least in part forthis reason, data, such as web scraping results and possibly job statusinformation, may be available at one computing device within webscraping system 104 at one geographic location, but not another. Toimprove efficiency, it is advantageous to ensure that a request for theresults is directed to the correct computing device at the correctgeographic location.

FIGS. 12A-B illustrate systems for load balancing web scraping requeststhat direct a request for results to the same subdomain that requestedresults from a target. FIG. 12A shows a system 1200 with tiered loadbalancers across different locations.

As illustrated in FIG. 12A, system 1200 which includes a data centerbalancer 1202 that can distribute API requests from client computingdevice 102 to one of several data centers 1206A . . . N. In one example,data center balancer 1202 may operate by sending back to clientcomputing device 102 an HTTP redirect to one of several destinationseach addressable by a hostname. In another example, data center balancer1202 may act as a proxy, forwarding requests from client computingdevice 102 to a respective data center.

As illustrated in FIG. 12A, the possible destinations are located atdifferent data centers 1206A . . . N. Each of the data centers 1206A . .. N is a building, a dedicated space within a building, or a group ofbuildings used to house computer systems and associated components, suchas telecommunications and storage systems. Each may include redundant orbackup components and infrastructure for power supply, datacommunication connections, environmental controls (e.g., airconditioning, fire suppression), and various security devices.

In system 1200, different data centers 1206A . . . N include one or moreload balancers and one or more instances of request intake manager 302,which, as described above, is a software server that accepts incomingAPI requests from client computing device 102. In the example in FIG. 12, data center 1206A includes load balancer 1208-1A . . . N and requestintake manager 302-1A . . . N; data center 1206B includes load balancer1208-2A . . . N and request intake manager 302-2A . . . N; and datacenter 1206N includes load balancer 1208-M, A . . . N and request intakemanager 302-M, A . . . N.

Each of the load balancers and request intake managers are addressableby a hostname. A hostname is a label that is assigned to a deviceconnected to a computer network and that is used to identify the devicein various forms of electronic communication. Internet hostnames, likethose shown in FIG. 12A, are composed of a sequence of labelsconcatenated with dots. The hostname is resolvable into an Internetprotocol (IP) address (that is, an OSI layer 3 network address) usingthe domain name system. The domain name system is a hierarchical namingspace, where the rightmost label conveys the top-level domain and thehierarchy descends right to left, each label to the left specifying asubdomain of the domain to the right. In an embodiment, it is notnecessary to differentiate between intake managers in the same DC, sothey need not have direct hostnames.

In the example in FIG. 12 , the host names of all the host loadbalancers and request intake manager's have the top level domain “net.”All are within a subdomain “example.net” of “net.” Each has a uniquesubdomain within “example.net” representing the particular networkaddress for the load balancer or request intake manager service. Theunique subdomains might follow a regular naming pattern.

For the respective data centers 1206A-N, load balancers 1208-1A . . . N,load balancers 1208-2A . . . N, and load balancers 1208-M, A . . . Ndetermine how to distribute requests among the various request intakemanagers 302-1A . . . N, request intake managers 302-2A . . . N, andrequest intake managers 302-M, A . . . N in the corresponding datacenters 1206A-N. The group of request intake managers and load balancerswithin each data center request intake managers and load balancers whichmay be referred to as a “leg.”

Each load balancer may work as a proxy distributing requests amongcorresponding request intake managers in a particular fashion, such asround-robin. They may, for example, use OSI layer 4 (transport layer)load-balancing forwarding all port 80 TCP requests onto the backend,which may constitute the corresponding group of request intake managers.In this way, the load balancers distribute requests among correspondingrequest intake managers.

In an example operation, client computing device 102 may make a new APIrequest to web scraping system 104. For usability purposes, data centerbalancer 1202 may represent the main entry point into web scrapingsystem 104. For example, all new requests may be sent to the hostname“api.example.io,” which addresses data center balancer 1202.

With a new web scraping request, which data center, whether 1206A . . .N and request intake manager 302-1-M, A-N or another, ultimatelyservices the request may not matter. Data center balancer 1202 mayselect which leg and which load balancer within the leg in a random orround-robin fashion. Alternatively, data center balancer 1202 may selecta data center 1206A . . . N out of geographical convenience. Data centerbalancer 1202 redirects the API request for web scraping to one of theload balancers, which selects one of the corresponding request intakemanagers and accesses the proxy to forward the request on to thecorresponding request intake manager. From there, request intake manager302 validates the request, and causes web scraping system 104 to store ajob description in job database 314, initiating the scraping operation,as described above. Once the job is initiated, request intake manager302 may return, perhaps through load balancer 1208, a job identifier.

As mentioned above, the web scraping request may be asynchronous. In thecase of an asynchronous request, client computing device 102 may make asecond API request to retrieve the results of the previously requestedweb scraping job. In addition, as described above, client computingdevice 102 may make additional API requests to request the status orother information related to the previously requested web scraping job.To identify the relevant job, the API request may include the jobdescription identifier to which it relates.

In that circumstance, at least in one embodiment, client computingdevice 102 may send the API request to data center balancer 1202. Datacenter balancer 1202 has a job look up table 1204. Job look up table1204 may match a job identification number to a corresponding databaseshard and may match a corresponding database shard to a data centerresponsible for that shard in that job. Then, data center balancer 1202may direct the API request to the hostname of a load balancer of a datacenter with the data needed to respond to the API request.

FIG. 12B illustrates an alternative embodiment. As mentioned above, whenrequest intake manager 302 accepts the initial request, it may return toclient computing device 102 a job identifier for the job. In addition,client computing device 102 can return a hostname or complete URL of therequest intake manager 302 corresponding to the shard that will receivethe results. When the results are available, web scraping system 104 maynotify client computing device 102. Alternatively or additionally, thatnotification message could include the hostname or complete URL of therequest intake manager 302 corresponding to the shard that has theresults. By supplying the hostname in this manner, client computingdevice 102 can retrieve the results and request status informationdirectly from the data center that has the data requested.

However, sometimes, client computing device 102 will nonetheless makethe request directly to the common entry point offered by data centerbalancer 1202. In that situation, when the request reaches a data center1206A-N, software at the data center, such as a load balancer or requestintake manager, determines whether the request has reached the correctleg. If it has not, then it identifies the correct leg and identifies ahostname that corresponds to that leg. With the hostname identified, thesoftware returns a redirect command to client computing device 102 to goto the correct leg that has the data the client requested.

To identify the correct leg, each request intake manager 302 (or loadbalancers 1208) may need to know which data center is responsible forthe shard that has the data that the user requested. For example, therequest intake manager 302 (or load balancers 1208) may need to map thejob identifier with a shard identifier and match the shard identifierwith the hostname of a particular leg, such as is described above withrespect to job lookup 1204 in FIG. 12A.

FIGS. 13A-B illustrate methods for operation of the systems in FIGS.12A-B. FIG. 13A illustrates a method 1300 for processing a new webscraping request and FIG. 13B illustrates a method 1350 for retrievingstatus or results of a prior web scraping job.

Starting with method 1300, at 1302, a request to scrape content isreceived at the main entry point, such as data center balancer 1202described with respect to FIGS. 12A and B. The request may be anasynchronous API request to request that the web scraping system scrapethe target website as described above and may specify the targetwebsite.

At 1304, the web scraping request is generated and executed. The webrequest for the target website is generated as specified in the APIrequest. The web request is transmitted such that the web requestreaches the target website via a proxy selected from a group of proxies.And, in response to the web request, scraped content is received fromthe target website via the proxy.

At 1306, web scraping system 104 sends a message to client computingdevice 102 acknowledging the request. The message may include a jobidentifier and may specify an address or hostname (such as a sub-domain)for the client computing device 102 to retrieve the scraped content.

Turning to method 1350, at 1352, an API request is received from clientcomputing device 102. The API request relates to a web scraping job thatwas previously requested of a web scraping system. For example, the APIrequest may request results of the web scraping job or a state of theweb scraping job.

At 1354, a hostname addressing a host at a data center of a plurality ofdata centers executing the web scraping system is identified. The datacenter identified is the one that is servicing or has serviced the webscraping job.

At 1356, the API request is directed to the identified hostname. Steps1352-1356 may be executed by data center balancer 1202 as the main entrypoint for web scraping system 104, as described above with respect toFIG. 12A. Alternatively or additionally, steps 1352-1356 may be executedby request intake manager 302, as described above with respect to FIG.12B. To direct the API request to the identified hostname, web scrapingsystem 104 may return an instruction to client computing device 102 toredirect to the identified hostname, for example using an HTTP redirectresponse. Alternatively, the respective request intake manager 302 mayact as a proxy to forward the API request to the identified hostname.

Finally, at 1358, the API request is serviced at the identified datacenter, servicing the API request. In this way, the requested results orstatus is returned to client computing device 102.

Token-Based Authentication for a Proxy Web Scraping Service

An API call from client computing device 102 may include credentialsthat enable a client to authenticate herself. Web scraping service 104may subscribe clients at different service levels so it is important toauthenticate the client when receiving API requests. Traditionally, webscraping systems may have had to re-authenticate the credentials atseveral points in the scraping process.

According to an embodiment, the credentials are authenticated at anentry point of the system where a token is generated that is passedalong to various servers within web scraping system 104. The variousservers within web scraping system 104 may use the token as a way tocheck the client's identity. With the client's identity confirmed, thevarious servers within web scraping system 104 can provide functionsaccording to a service level to which the client has subscribed.

FIG. 14 illustrates a system 1400 for token-based authentication at aload balancer for a web scraping system.

In system 1400, request intake manager 302 includes three sets of APIreceivers, each set of API receivers being a set of servers configuredto accept a different type of web scraping request. URL API receiver1402A . . . N accepts a web scraping request including a fully formattedURL. API receiver 1402A . . . N may accept API requests as HTTP proxy asdescribed above. When such an HTTP proxy request is received at APIreceiver 1402A . . . N, the respective API receiver 1402A . . . Nreformats the request according to an API with known parameters andsends the reformatted request to at least one of synchronous APIreceivers 1404A . . . N.

Synchronous API receiver 1404A . . . N is configured to accept asynchronous, that is, realtime, web scraping request. When a synchronousAPI receiver 1404A . . . N receives a web scraping request, it leavesthe TCP/HTTP connection with the client computing device 102 open untilthe scraped results are available. Once web scraping system 104 hascompleted the scraping request, the respective synchronous API receiver1404A . . . N returns the scraped results to client computing device102. To conduct the web scraping request, synchronous API receiver 1404A. . . N may send the API request to at least one of asynchronous APIreceivers 1406A . . . N.

Asynchronous API receiver 1406A . . . N may be the entry point into theremainder of web scraping system 104 as described above. For example, asdescribed above, asynchronous API receiver 1406A . . . N may generate ajob description and send the job description to request status manager304, which initiates the scraping job. When asynchronous API receiver1406A . . . N receives an API request from client computing device 102or from synchronous API receiver 1404A . . . N, asynchronous APIreceiver 1406A . . . N closes the connection to the receiver or devicebefore the web scraping is complete, perhaps replying with anacknowledgment. Once the web scraping is complete and results areavailable at web scraping system 104, the client computing device 102 orsynchronous API receiver 1404A . . . N receives a callback notificationthat results are available. In this way, an API request is passedbetween a plurality of servers, each configured to perform a function ofweb scraping system 104.

Each set of API receivers is accessible via a respective load balancers1208A-C, and each of the respective load balancers 1208A-C may representan entry point into web scraping system 104 for client computing device102. As described above, each of load balancers 1208A-C distributerequests among the plurality of associated receivers to utilize anddistribute requests across the multiple, parallel servers.

In the example in FIG. 14 , a client desiring to send an API requestusing the full

URL of the destination, such as using the Web proxy protocol asdescribed above, may send the API request to a hostname“url.example.io.” That request would reach load balancer 1208A. Loadbalancer 1208A selects one of URL API receivers 1402A . . . N to handlethe request and forwards the API request on to the selected receiver.The selected API receiver 1402A . . . N reformats the proxy request intoa different API format and sends on to one of synchronous API receivers1404A . . . N, which forwards the requests on to one of asynchronous APIreceivers 1406A . . . N. When the request is completed and results arescraped, the selected synchronous API receiver 1404A . . . N is notifiedand returns scraped results to the selected URL API receiver 1402A . . .N. The selected URL API receiver 1402A . . . N formats the response as aproxy response and sends the response to client computing device 102.

Continuing the example operation in FIG. 14 , a client desiring to sendan API request using a synchronous API call may send the API request toa hostname “sync.example.io.” That request would reach load balancer1208B. Load balancer 1208B selects one of synchronous API receivers1404A . . . N to handle the request and forwards the API request on tothe selected receiver. The selected synchronous API receivers 1404A . .. N keeps the connection open while forwarding the API request toasynchronous API receiver 1406A . . . N, which sends the job forscraping. When the results are available, the selected synchronous APIreceiver 1404A . . . N is notified and returns the results to clientcomputing device 102, closing the connection.

Finally, continuing the example operation in FIG. 14 , a client desiringto send an API request using an asynchronous API call may send the APIrequest to a hostname “api.example.io.” That request would reach loadbalancer 1208C. Load balancer 1208C selects one of asynchronous APIreceivers 1406A . . . N to handle the request and forwards the APIrequest on to the selected receiver. The selected asynchronous APIreceivers 1404A . . . N close a connection between the web scrapingsystem 104 and the client computing device while the web scraping systemscrapes the target website.

According to an embodiment, each load balancer 1208A-C includes arespective Load balance service 1404A-C and authentication service1412A-C. Load balance service 1404A-C performs the backend selection andproxy forwarding or redirection for the load balancer as describedabove. On receipt of a request, Load balance service 1404A-Ccommunicates with the respective authentication service 1412A-C toauthenticate the user.

In particular, each of authentication service 1412A-C is configured tovalidate credentials received with an API request from client computingdevice 102. When the authentication service 1412A-C cannot validate thecredentials, the respective load balancer 1208A-C refuses to servicereceived API request. When the authentication service 1412A-C validatesthe credentials, the authentication service 1412A-C generates a tokenindicating an identity of a client associated with the credentials. Loadbalancer 1208A-C transmits the API request along with the token to aserver configured to initiate a scraping process on the web scrapingrequest.

The token may be passed along with the API request to the various APIreceivers and other servers and modules providing functions within webscraping system 104. These various servers analyze the token todetermine whether the client is authorized to conduct the functionperformed by the respective server, and when the client is authorized toconduct the function, perform the function, such as handling aparticular type of API or conducting a particular type of scrapingrequest. To conduct the analysis, a server may check the level ofservice of the client indicated within the token. Based on the level ofservice, the server may determine whether the function provided by theserver is authorized. Moreover, when an API request is made to retrievepreviously scraped results or to check status of a previously maderequest, a server may use the token to determine whether thepreviously-made request was made by the same client.

In addition to specifying the client, the token may specify a role forthe client.

Subsequent servers may use the role within the token to determinewhether a particular function of web scraping system 104 is authorized.In an example, an “admin” role may allow the request made by any client,while a “user” role may allow the request to retrieve only the datarequested by the authenticated client.

FIG. 15 shows a system 1500 illustrating the operation of token-basedauthentication for a web scraping system 104 in greater detail. Loadbalance service 1410 makes a request 1502 of authentication service1412. Request 1502 may, for example, be an HTTP POST request. The bodyof the post request may have credentials, and a path used by the POSTrequest and may contain the type of credentials being used. Credentials,for example, may be a username and password. In another example, thecredentials can be a token.

Authentication service 1412 compares the credentials to what is storedin a credentials database 1506. Credentials database 1506 may havemultiple layers in a memory hierarchy to speed up lookup. Based on thatcomparison, authentication service 1412 generates and returnsauthentication token 1504.

In an example, token 1504 may be a JSON Web Token (JWT). Token 1504includes a header 1510, payload 1512, and digital signature 1514. Header1510 may indicate the algorithm and type used for the JSON. Payload 1512may have data regarding the authentication. This can include theclient's identity, services to which the client has subscribed, roles ofthe client, and expiration date/time for the token, and whether theauthentication was successful.

Digital signature 1514 uses cryptographic methods to guarantee that thepayload of the client has not been tampered with. For example,generating digital signature 1514 may involve generating a one-way hashand encrypting it with a private key of the authentication service 1412.Then, when digital signature 1514 is verified, the public key is used todecrypt the hash and compare it with a hash of the payload 1512. In thisway, digital signature 1514 can be used to verify that the payload hasnot been tampered with by anyone who does not have possession of theprivate key.

Cold Database for Archiving Results of Web Scraping Across Data Centers

As mentioned above, web scraping system 104 may include a historyarchive 306 that stores the scraped data for longer periods. Historyarchive 306 allows a user to track changes to a target website overtime. To retrieve data, a client may request a dump from a historyarchive 306 of the previously scraped results that meet certaincriteria. In particular, the client's search criteria may describemetadata of results sought to be retrieved. The metadata may be comparedto an index that describes the results. Based on the index, links to theresults may be returned to the client.

However, as described above, functionality of web scraping system 104may be spread across multiple data centers. Each data center may haveits own index. According to an embodiment, results from the variousindexes are combined to generate search results corresponding toparticular search criteria. Aspects of this feature are illustrated inFIG. 16 .

FIG. 16 illustrates a system 1600 that stores results from a pluralityof data centers into an archive database.

System 1600 includes an access server 1630 and an archive database 1612.In an example, archive database 1612 may store parsed data scraped byweb scraping system 104. As an example, the parsed data retrieved foreach web scraping request may be stored as a JSON file and written toarchive database 1612. The web scraping system 104 stores the scrapeddata into archive database 1612, where it is available for futureanalysis.

To access data in archive database 1612, client computing device 102 maysend a request to access server 1630. The request may address a locationof the desired JSON file within archive database 1612. Access server1630 retrieves data from archive database 1612 via one or more cloudinterfaces 1604A-B. Cloud interfaces 1604A-B may have the credential andinterface information needed to send and retrieve data from archivedatabase 1612.

Archive database 1612 may be a cloud storage service. It may be anInfrastructure as a service (IaaS), it may utilize encryption forsecurity and data compression for bandwidth, storage, and latencyoptimization. Similarly, dump database 1610 may also be a cloud storagedatabase.

Each respective data center 1206A-B includes a scraper (not shown inFIG. 16 ), parser 308A-B, and history archive 306A-B. Each historyarchive 306A-B includes a writer 1602A-B, cloud interface 1604A-B, index1606A-B, and dumper 1608A-B.

As described above with respect to FIGS. 3 and 4 , the scraper isconfigured to generate a web request for a target website according to ajob description generated based on an API request. The scraper transmitsthe generated web request to the target website via one or more proxies.In response to the web request, the scraper receives a content from thetarget website. Also as described above, parser 308A-B are eachconfigured to parse the response from the target website. The parsedcontent may be represented, for example, as a data structure in a JSONformat. Parser 308A-B sends the parsed content to the respective writer1602A-B.

Once received from parser 308A-B, the respective writer 1602A-B sendsthe parsed content to the respective cloud interface 1604A-B to bewritten to archive database 1612. In addition, metadata about thescraped content is saved to index 1606A-B. The metadata may include, forexample, any of the information in the corresponding API request or jobdescription and a time stamp when the scraping actually occurred.

Information from a target website may only be stored in archive database1612 at a particular frequency. In other words, if content is retrievedfrom a target website (with particular parameters, as set out in the jobdescription) and was recently stored in archive database 1612, writer1602A-B may decline to write it again. In this way, storage is conservedon archive database 1612.

To determine whether a writer 1602A-B has previously archived contentfrom the target website, writer 1602A-B may compare metadata parameterswith entries already existing in its respective index 1606A-B. Becausethe respective index 1606A-B may only have metadata of content storedfrom a particular data center, additional synchronization andde-duplication may need to occur as described below with respect to FIG.17 .

Having the index distributed across multiple data centers means thatsearch criteria must be distributed across multiple servers to searchall the indexes. If client computing device 102 wishes to retrieve aplurality of scraped results meeting certain criteria, client computingdevice 102 sends the search criteria to web scraping system 104. Thesearch criteria is distributed among a plurality of data centers 1206A-Band is received by a respective dumper 1608A-B. The respective dumper1608A-B searches the respective index 1606A-B at that data center anddetermines what entries in the index file satisfy the search criteria.In particular, each entry may have metadata describing the searchresults and the metadata for each entry which may be compared againstthe search criteria. The dumper 1608A-B sends the resulting list,including links to the location within archive database 1612 where thescraped results may be found, to a dump database 1610, where they arecombined.

As shown in in FIG. 16 , client computing device 102 reads the combinedresults as 1622 from dump database 1610. Then, client computing device102 sends each individual link to access server 1630, which uses theaddress of the scraped results to retrieve the appropriate results fromarchive database 1612 and return the retrieved results to clientcomputing device 102.

FIG. 17 illustrates a system 1700 that de-duplicates data scraped from aplurality of data centers before storing into an archive database.

As mentioned above, when parsed, scraped content is stored in thearchive, writer 1602A-B writes metadata describing the respectivecontent into respective index file 1606A-B. At that time, writer 1602A-Bwill send the metadata to other data centers via a data feed 1702.

Data feed 1702 may be a software bus that uses stream-processing todistribute real-time data feeds. It may use a binary TCP-based protocoland may rely on “message set” obstruction which groups messages togetherto reduce the overhead of the network round trip.

Each respective data center includes a respective feed receiver 1704A-B.The feed receiver is configured to accept data feed 1702, streamingmetadata from other data centers and storing it into the respectiveprior scraped file 1706A-B. Each metadata entry may be stored with anexpiration date. The expiration date may be set based on the time periodto preclude future scrapes from being archived, such as one month. Whenthe expiration date occurs, the entry may be removed from the priorscraped file 1706A-B.

To determine whether another data center has previously retrieved thecontent from the target website and stored it in archive database 1612,the respective writer 1602A-B may compare metadata parameters withentries existing in its prior scraped file 1706A-B. In this way,duplications across data centers within archive database 1612 areavoided.

CONCLUSION

Each of the modules, servers and other components described above(including client computing device 102, web scraping system 104, Webproxy 106A . . . N, target Web server 108, scraper 310, parser 308,request intake manager 302, request status manager 304, central messagequeue 312, history archive 306, proxy rotator 486, target scraper 4606A-N, message queue 454, notifier 460, external database writer 464, APIreceiver 402A-N, in memory access server 450, database servers 404A-N,message queue 454, micro service 456, throttler 502, throttle queue 702A. . . N, job remover 704, queue selector 716, invoice generator 808A,traffic counter 802, limit checker 804, database server selector 1100,load balancer 1208, data center balancer 1204, URL API receiver 1402A-N,synchronous API receiver 1404A-N, asynchronous API receiver 1406A-N,load balance service 1410A-C, authentication service 1412A-C, writer1602A-B, cloud interface 1604A-B, dumper 1608A-B, and access server1630) may be implemented on software executed on one or more computingdevices or different computing devices.

A computing device may include one or more processors (also calledcentral processing units, or CPUs). The processor may be connected to acommunication infrastructure or bus. The computer device may alsoinclude user input/output device(s), such as monitors, keyboards,pointing devices, etc., which may communicate with communicationinfrastructure through user input/output interface(s).

One or more of the processors may be a graphics processing units (GPU).In an embodiment, a GPU may be a processor that is a specializedelectronic circuit designed to process mathematically intensiveapplications. The GPU may have a parallel structure that is efficientfor parallel processing of large blocks of data, such as mathematicallyintensive data common to computer graphics applications, images, videos,etc.

The computer device may also include a main or primary memory 408, suchas random access memory (RAM). Main memory 408 may include one or morelevels of cache. Main memory 408 may have stored therein control logic(i.e., computer software) and/or data.

The computer device may also include one or more secondary storagedevices or memory. The secondary memory may include, for example, a harddisk drive, flash storage and/or a removable storage device or drive.

The computing device may further include a communication or networkinterface.

The communication interface may allow the computer system 400 tocommunicate and interact with any combination of external devices,external networks, external entities, etc. For example, thecommunication interface may allow the computer system to access externaldevices via network 100, which may be wired and/or wireless (or acombination thereof), and which may include any combination of LANs,WANs, the Internet, etc

The computing device may also be any of a rack computer, server blade,personal digital assistant (PDA), desktop workstation, laptop ornotebook computer, netbook, tablet, smartphone, smartwatch or otherwearable, appliance, part of the Internet-of-Things, and/or embeddedsystem, to name a few non-limiting examples, or any combination thereof.

The computer device may access or host any applications and/or datathrough any delivery paradigm, including but not limited to remote ordistributed cloud computing solutions; local or on-premises software(“on-premise” cloud-based solutions); “as a service” models (e.g.,content as a service (CaaS), digital content as a service (DCaaS),software as a service (SaaS), managed software as a service (MSaaS),platform as a service (PaaS), desktop as a service (DaaS), framework asa service (FaaS), backend as a service (BaaS), mobile backend as aservice (MBaaS), infrastructure as a service (IaaS), etc.); and/or ahybrid model including any combination of the foregoing examples orother services or delivery paradigms.

Any applicable data structures, file formats, and schemas in thecomputing devices may be derived from standards including but notlimited to JavaScript Object Notation (JSON), Extensible Markup Language(XML), Yet Another Markup Language (YAML), Extensible Hypertext MarkupLanguage (XHTML), Wireless Markup Language (WML), MessagePack, XML UserInterface Language (XUL), or any other functionally similarrepresentations alone or in combination. Alternatively, proprietary datastructures, formats or schemas may be used, either exclusively or incombination with known or open standards. Any of the databases or filesdescribed above (including job database 314 In-memory job table 452,HTML cache 462, throttle configuration database 714, traffic countdatabase 806, database server status table 1008, credentials database1506, archive database 1612, and dump database 1610) may be stored inany format, structure, or schema in any type of memory and in acomputing device.

In some embodiments, a tangible, non-transitory apparatus or article ofmanufacture comprising a tangible, non-transitory computer-usable orreadable medium having control logic (software) stored thereon may alsobe referred to herein as a computer program product or program storagedevice. This includes, but is not limited to, main memory, secondarymemory, and removable storage units, as well as tangible articles ofmanufacture embodying any combination of the foregoing. Such controllogic may cause such data processing devices to operate as describedherein.

A website is a collection of web pages containing related contentsidentified by a common domain name and published on at least one webserver. A domain name is a series of alphanumeric strings separated byperiods, serving as an address for a computer network connection andidentifying the owner of the address. Domain names consist of two mainelements — the website's name and the domain extension (e.g., .com).Typically, websites are dedicated to a particular type of content orservice. A website can contain hyperlinks to several web pages, enablinga visitor to navigate between web pages. Web pages are documentscontaining specific collections of resources that are displayed in a webbrowser. A web page's fundamental element is one or more text fileswritten in Hypertext Markup Language (HTML). Each web page in a websiteis identified by a distinct URL (Uniform Resource Locator). There aremany varieties of websites, each providing a particular type of contentor service.

Identifiers, such as “(a),” “(b),” “(i),” “(ii),” etc., are sometimesused for different elements or steps. These identifiers are used forclarity and do not necessarily designate an order for the elements orsteps.

The present invention has been described above with the aid offunctional building blocks illustrating the implementation of specifiedfunctions and relationships thereof. The boundaries of these functionalbuilding blocks have been arbitrarily defined herein for the convenienceof the description. Alternate boundaries can be defined so long as thespecified functions and relationships thereof are appropriatelyperformed.

The foregoing description of the specific embodiments will so fullyreveal the general nature of the invention that others can, by applyingknowledge within the skill of the art, readily modify and/or adapt forvarious applications such as specific embodiments, without undueexperimentation, and without departing from the general concept of thepresent invention. Therefore, such adaptations and modifications areintended to be within the meaning and range of equivalents of thedisclosed embodiments based on the teaching and guidance presentedherein. It is to be understood that the phraseology or terminologyherein is for the purpose of description and not of limitation, suchthat the terminology or phraseology of the present specification is tobe interpreted by the skilled artisan in light of the teachings andguidance.

The breadth and scope of the present invention should not be limited byany of the above-described exemplary embodiments, but should be definedonly in accordance with the following claims and their equivalents.

The disclosure presents a computer-implemented method for executing aplurality of web scraping requests over time, comprising:

(a) during a first time period, receiving a plurality of web scrapingrequests from a client computing device, each of the plurality of webscraping requests specifying a target website to capture content from;

(b) placing job descriptions for the plurality of web scraping requestson a queue, the job descriptions each describing at least one webscraping job specified by a request from the plurality of requests;

(c) incrementally over a second time period longer than the first timeperiod, removing the job descriptions from the queue;

when each respective job description is removed from the queue:

(d) generating a web request for the target website as specified in thejob description; and

(e) transmitting the web request such that the web request reaches thetarget website via a proxy selected from a group of proxies.

The method is presented wherein the removing (c) occurs in incrementsselected to avoid the group of proxies from becoming blocked by thetarget website.

The method is presented further comprising:

in response to the web request, receiving content transmitted from thetarget website; and

(g) transmitting the received content to the client computing device.

The method is presented wherein the plurality of web scraping requestseach include a client identifier indicating a client from which the webscraping request originates, further comprising:

(f) selecting the queue from a plurality of queues based on the clientidentifier.

The method is presented wherein the plurality of web scraping requestseach further include an identifier of the target website, furthercomprising:

(g) selecting the queue from the plurality of queues based on theidentifier of the target website.

The method is presented further comprising selecting the queue from theplurality of queues based on whether the job description specifies thatweb scraping be made from a headless browser.

The method is presented further comprising, when the job descriptionrequests that web scraping be made from the headless browser:

(h) in response to the web request, receiving content specifying a webpage, the content transmitted from the target website;

(i) analyzing the content to determine web addresses for additionalcontent needed to render the web page; and (j) requesting the additionalcontent from the web addresses.

The method is presented wherein incrementally removing (c) comprisesrepeated removing a job description from the queue at a time window.

The method is presented wherein incrementally removing (c) comprisesrepeated removing a plurality of j ob descriptions from the queue at thetime window.

The method is presented wherein an amount of job descriptions in theplurality of job descriptions are specified based on a client that sentthe plurality of web scraping requests.

The method is presented further comprising:

(f) determining that web scraping requests from the client computingdevice no longer need to be throttled;

(g) determining when the queue is empty; and

(h) when the queue is determined to be empty, deleting the queue.

The method is presented further comprising:

(f) determining which of the plurality of web scraping requests aresynchronous requests and which are asynchronous requests; and

(g) prioritizing web scraping requests determined in (f) to besynchronous requests over web scraping requests determined in (f) to beasynchronous requests to help ensure that results from synchronousrequests are returned before a connection with the client computingdevice times out.

A system is presented for executing a plurality of web scraping requestsover time, comprising:

at least one processor;

a memory configured to store a queue;

a request intake manager configured to, during a first time period,receive a plurality of web scraping requests from a client computingdevice, each of the plurality of web scraping requests specifying atarget website to capture content from;

a throttler configured to place job descriptions for the plurality ofweb scraping requests on the queue, the job descriptions each describingat least one web scraping job specified by a request from the pluralityof requests;

a job remover configured to, incrementally over a second time periodlonger than the first time period, remove the job descriptions from thequeue;

a scraper configured to, when each respective job description is removedfrom the queue, generate a web request for the target website asspecified in the job description, and transmitting the web request suchthat the web request reaches the target website via a proxy selectedfrom a group of proxies.

The system is presented wherein the job remover is configured to removein increments selected to avoid the group of proxies from becomingblocked by the target web site.

The system is presented wherein the scraper is configured to, inresponse to the web request, receive content transmitted from the targetweb site, and the request intake manager is configured to notify theclient that the received content is available for transmission to theclient computing device;

The system is presented further comprising a memory configured to storea plurality of queues, wherein the plurality of web scraping requestseach include a client identifier indicating a client from which theclient originates, further comprising:

a queue selector that selects the queue from a plurality of queues basedon the client identifier.

The system is presented wherein the plurality of web scraping requestseach further include an identifier of the target website, the queueselector is configured to select the queue from the plurality of queuesbased on the identifier of the target website.

The system is presented further comprising the queue selector configuredto select the queue from the plurality of queues based on whether thejob description specifies that web scraping be made from a headlessbrowser.

The system is presented further comprising:

a throttle configuration database that stores a regular time windowassociated with the queue, wherein the job remover repeatedly removes ajob description from the queue at the time window.

A non-transitory computer-readable device having instructions storedthereon is presented that, when executed by at least one computingdevice, cause the at least one computing device to perform operationscomprising:

(a) during a first time period, receiving a plurality of web scrapingrequests from a client computing device, each of the plurality of webscraping requests specifying a target website to capture content from;

(b) placing job descriptions for the plurality of web scraping requestson a queue, the job descriptions each describing at least one webscraping job specified by a request from the plurality of requests;

(c) incrementally over a second time period longer than the first timeperiod, removing the job descriptions from the queue;

when each respective job description is removed from the queue:

(d) generating a web request for the target website as specified in thejob description; and

(e) transmitting the web request such that the web request reaches thetarget website via a proxy selected from a group of proxies.

A computer-implemented method for tracking user activity is presented,comprising:

(a) receiving a web scraping request from a client computing device, theweb scraping request specifying a target web site to capture contentfrom;

(b) based on the web scraping request, generating a web request for thetarget web site;

(c) transmitting the web request such that the web request reaches thetarget website via a proxy selected from a group of proxies;

(d) in response to the web request, receiving, via the proxy, contenttransmitted from the target web site;

(e) counting an amount of data in the received content to determine acurrent traffic total for a client of the client computing device; andtransmitting the received content to the client computing device.

The method is presented, further comprising:

(g) based on the current traffic total, generating an invoice for aclient corresponding to the client computing device.

The method is presented, wherein the current traffic total is for a timeperiod, further comprising:

(g) receiving an additional web scraping request from the clientcomputing device;

(h) determining whether the current traffic total exceeds a maximumallowable for a client corresponding to the client computing device; and

(i) when the current traffic total is determined to exceed the maximumallowable in (h), refusing to service the additional web scrapingrequest.

The method is presented, wherein the current traffic total is for a timeperiod, further comprising:

(g) receiving an additional web scraping request from the clientcomputing device;

(h) determining whether the current traffic total exceeds a maximumallowable for a client corresponding to the client computing device; and(i) when the current traffic total is determined to exceed the maximumallowable in (h), terminating the additional web scraping request.

The method is presented, further comprising:

(g) determining whether the target web site has refused to serve the webrequest from the proxy, wherein steps (b)-(f) are conducted when thetarget website is determined in (g) not to have refused to serve the webrequest from the proxy.

The method is presented, further comprising:

(i) when the target web site is determined in (g) to have refused toserve the web request from the proxy, retrying to send the web requestto the target website via a different proxy.

The method is presented, further comprising:

(g) selecting a scraper from a plurality of scrapers based on the targetweb site such that the selected scraper includes instructions on how togenerate the web request to extract data from the target web site,

wherein the generating (b) comprises generating the web requestaccording to the instructions in the selected scraper, and

wherein the counting (e) comprises counting the amount of data in thereceived content to determine a current traffic total retrieved by thescraper for the client.

The method is presented, wherein the web request is a second webrequest, and the received content is a second content, furthercomprising:

(g) selecting a scraper from a plurality of scrapers based on the targetweb site such that the selected scraper includes instructions on how togenerate a first web request and the second web request;

(f) generating the first web request for the target web site accordingto the instructions;

(g) transmitting the first web request such that the web request reachesthe target website via the proxy; and

(h) in response to the first web request, receiving, via the proxy, afirst content including a data transmitted from the target website viathe proxy,

wherein the generating (b) comprises generating, based on the data, thesecond web request according to the instructions in the selectedscraper.

The method is presented, wherein the counting (e) comprises excluding anamount of data in the first content to determine the current traffictotal retrieved by the scraper for the client.

The method is presented, wherein the counting (e) comprises determiningthe amount of data in the received content as compressed fortransmission.

The method is presented, wherein the counting (e) further comprises:

(i) determining a type of data represented by the received content;

(ii) based on the type of data, determining a compression factorrepresenting an amount of compression expected when the type of data istransmitted over a network; and

(ii) based on the compression factor, determining the amount of data inthe received content as compressed for transmission.

The method is presented, further comprising:

(g) analyzing the content to determine web addresses for additionalcontent needed to render a web page; and

(h) retrieving the additional content from the web addresses,

wherein the counting (e) comprises including an amount of data in theadditional content in the current traffic total for a client of theclient computing device.

The method is presented, further comprising:

(g) receiving a request from a client corresponding to the clientcomputing device for an amount of data remaining;

(h) determining the amount of data remaining as a difference between thecurrent traffic total and a maximum allowable for the client; and

(i) returning the amount of data remaining to the client.

A non-transitory computer-readable device having instructions storedthereon is presented that, when executed by at least one computingdevice, cause the at least one computing device to perform operations,comprising:

(a) receiving a web scraping request from a client computing device, theweb scraping request specifying a target web site to capture contentfrom;

(b) based on the web scraping request, generating a web request for thetarget web site;

(c) transmitting the web request such that the web request reaches thetarget website via a proxy selected from a group of proxies;

(d) in response to the web request, receiving, via the proxy, contenttransmitted from the target web site;

(e) counting an amount of data in the received content to determine acurrent traffic total for a client of the client computing device; andtransmitting the received content to the client computing device.

The device is presented, the operations further comprising:

(g) determining whether the target web site has refused to serve the webrequest from the proxy, wherein steps (b)-(f) are conducted when thetarget website is determined in (g) not to have refused to serve the webrequest from the proxy.

The device is presented, the operations further comprising:

(h) when the target web site is determined in (g) to have refused toserve the web request from the proxy, retrying to send the web requestto the target website via a different proxy.

The device is presented, wherein the web request is a second webrequest, and the received content is a second content, furthercomprising:

(g) selecting a scraper from a plurality of scrapers based on the targetweb site such that the selected scraper includes instructions on how togenerate a first web request and the second web request;

(h) generating the first web request for the target web site accordingto the instructions;

(i) transmitting the first web request such that the web request reachesthe target website via the proxy; and in response to the first webrequest, receiving, via the proxy, a first content including a datatransmitted from the target website via the proxy,

wherein the generating (b) comprises generating, based on the data, thesecond web request according to the instructions in the selected scraper

wherein the counting (e) comprises excluding an amount of data in thefirst content to determine the current traffic total retrieved by thescraper for the client.

The device is presented, wherein the counting (e) comprises determiningthe amount of data in the received content as compressed fortransmission.

The device is presented, wherein the counting (e) further comprises:

(i) determining a type of data represented by the received content;

(ii) based on the type of data, determining a compression factorrepresenting an amount of compression expected when the type of data istransmitted over a network; and

(ii) based on the compression factor, determining the amount of data inthe received content as compressed for transmission.

The device is presented, further comprising:

(g) analyzing the content to determine web addresses for additionalcontent needed to render a web page; and

(h) retrieving the additional content from the web addresses, whereinthe counting (e) comprises including an amount of data in the additionalcontent in the current traffic total for a client of the clientcomputing device.

A computer-implemented method for determining which servers areavailable to process web scraping jobs is presented, comprising:

repeatedly checking health of each of a plurality of database servers;

based on the health checks, determine whether each of a plurality ofdatabase servers are to be enabled or disabled in a table, the pluralityof database servers operating independently of one another, eachdatabase servers configured to manage data storage to at least a portionof a job database that stores the status of web scraping jobs while theweb scraping jobs are being executed;

when a web scraping request is received from a client computing device:

selecting one of the database servers identified as enabled in thetable; and

sending a job description specified by the web scraping request to theselected database server for storage in the job database as a pendingweb scraping job.

The method is presented, wherein each of the repeated checkingcomprises, for each of the plurality of database servers, connecting tothe portion of the job database for the respective database server.

The method is presented, wherein each of the plurality of databaseservers comprises a message broker that queues job descriptions to bestored in the jobs database, and each of the repeatedly checkingcomprises, for each of the plurality of database servers, checking aconnection between a server that receives web scraping requests fromclient computing devices and the respective database server's messagebroker.

The method is presented, wherein each of the plurality of databaseservers comprises a message broker that queues job descriptions to bestored in the jobs database, and each of the repeatedly checkingcomprises, for each of the plurality of database servers, checking anumber of messages queued within the respective database server'smessage broker.

The method is presented, wherein each of the plurality of databaseservers is a shard managing storage in a horizontal partition of thejobs database.

The method is presented, wherein each of the plurality of databaseservers do not synchronize states to one another.

The method is presented, wherein the plurality of database servers areexecuted by a plurality of different computing devices.

The method is presented, further comprising:

determining whether a number of database servers that are disabled inthe plurality of database servers exceeds a threshold; and when thenumber of database servers that are disabled exceeds the threshold,alerting an administrator.

A non-transitory computer-readable device having instructions storedthereon is presented that, when executed by at least one computingdevice, cause the at least one computing device to perform operations,comprising:

repeatedly checking health each of a plurality of database servers;based on the health checks, determining whether each of a plurality ofdatabase servers are to be enabled or disabled in a table, the pluralityof database servers operating independently of one another, eachdatabase servers configured to manage data storage to at least a portionof a job database that stores the status of web scraping jobs while theweb scraping jobs are being executed;

when a web scraping request is received from a client computing device:selecting one of the database servers identified as enabled in thetable; and sending a job description specified by the web scrapingrequest to the selected database server for storage in the job databaseas a pending web scraping job.

The device is presented, wherein each of the repeatedly checkingcomprises, for each of the plurality of database servers, connecting tothe portion of the job database for the respective database server.

The device is presented, wherein each of the plurality of databaseservers comprises a message broker that queues job descriptions to bestored in the jobs database, and each of the repeatedly checkingcomprises, for each of the plurality of database servers, checking aconnection between a server that receives web scraping requests fromclient computing devices and the respective database server's messagebroker.

The device is presented, wherein each of the plurality of databaseservers comprises a message broker that queues job descriptions to bestored in the jobs database, and each of the repeatedly checkingcomprises, for each of the plurality of database servers, checking anumber of messages queued within the respective database server'smessage broker.

The device is presented, wherein each of the plurality of databaseservers is a shard managing storage in a horizontal partition of thejobs database.

The device is presented, wherein each of the plurality of databaseservers do not synchronize states to one another.

The device is presented, wherein the plurality of database servers areexecuted by a plurality of different computing devices.

The device is presented, further comprising:

determining whether a number of database servers that are disabled inthe plurality of database servers exceeds a threshold; and when thenumber of database servers that are disabled exceeds the threshold,alerting an administrator.

A system for determining which servers are available to process webscraping jobs is presented, comprising:

a processor;

a job database that stores the status of web scraping jobs while the webscraping jobs are being executed;

a memory that stores the job database;

a plurality of database servers operating independently of one another,each database servers configured to manage data storage to at least aportion of the job database;

a database monitor configured to repeatedly check health of each of theplurality of database servers and, based on the results of the healthchecks, determine whether each of the plurality of database servers areto be enabled or disabled in a table;

a database server selector configured to, when a web scraping request isreceived from a client computing device, select one of the databaseservers identified as enabled in the table; and

a request intake manager configured to send a job description specifiedby the web scraping request to the selected database server for storagein the job database as a pending web scraping job.

The system is presented, wherein the database monitor is configured to,for each of the plurality of database servers, check a connectionbetween the request intake manager and the jobs database.

The system is presented, wherein each of the plurality of databaseservers comprises a message broker that queues job descriptions to bestored in the job database, and the database monitor is configured to,for each of the plurality of database servers, check a connectionbetween a server that receives web scraping requests from clientcomputing devices and the respective database server's message broker.

The system is presented, wherein each of the plurality of databaseservers comprises a message broker that queues job descriptions to bestored in the jobs database, and the database monitor is configured to,for each of the plurality of database servers, check a messages queuedwithin the respective database server's message broker.

A computer-implemented method for distributing web scraping requestsover a plurality of data centers is presented, comprising:

(a) receiving an API request from a client computing device, the APIrequest relating to a web scraping job that was previously requested ofa web scraping system;

(b) identifying a hostname addressing a host at a data center of aplurality of data centers executing the web scraping system, the datacenter servicing the web scraping job;

(c) directing the API request to the identified hostname; and

(d) at the identified data center, servicing the API request.

The method is presented, wherein the API request is a second APIrequest, further comprising, at the identified data center:

receiving a first API request to request that the web scraping systemscrape content from a target website via a proxy, wherein the first APIrequest is received prior to the second API request;

generating a web request for the target website as specified in thefirst API request;

transmitting the web request such that the web request reaches thetarget website via a proxy selected from a group of proxies; and inresponse to the web request, receiving scraped content from the targetwebsite via the proxy.

The method is presented, wherein the second API request is to retrievestate of the web scraping job specified by the API request.

The method is presented, wherein the second API request is to retrievethe received scraped content.

The method is presented, further comprising:

sending a message to the client computing device, the message specifyinga sub-domain for the client computing device to retrieve the scrapedcontent.

The method is presented, wherein the hostname addresses a load balancerthat balances requests among a plurality of servers that accept webscraping requests.

The method is presented, wherein steps (a)-(c) are executed at a datacenter balancer that selects which data center of the plurality of datacenters to service the web scraping job.

The method is presented, wherein the data center is at a first datacenter wherein steps (a)-(c) are executed at a second data centerdifferent from the first data center.

The method is presented, wherein the directing (c) comprises sending aninstruction to the client computing device directing the clientcomputing device to resend the API request to the sub-domain.

The method is presented, wherein the directing (c) comprises forwardingthe API request to the sub-domain for the first data center processingthe request, further comprising:

at the second data center, forwarding the scraped content from the firstdata center to the client computing device.

The method is presented, wherein the plurality of data centers executingthe web scraping system each operate to accept job requestsindependently of one another, wherein status and results from the APIrequest are stored on one of a plurality of independent, horizontallypartitioned database shards.

A non-transitory computer-readable device having instructions storedthereon is presented that, when executed by at least one computingdevice, cause the at least one computing device to perform operations,the operations comprising:

(a) receiving an API request from a client computing device, the APIrequest relating to a web scraping job that was previously requested ofa web scraping system;

(b) identifying a hostname addressing a host at a data center of aplurality of data centers executing the web scraping system, the datacenter servicing the web scraping job; and

(c) directing the API request to the identified hostname for servicingat the identified data center.

The device is presented, wherein the API request is a second APIrequest, further comprising, at the identified data:

receiving a first API request to request that the web scraping systemscrape content from a target website via a proxy, wherein the first APIrequest is received prior to the second API request;

generating a web request for the target website as specified in thefirst API request;

transmitting the web request such that the web request reaches thetarget website via a proxy selected from a group of proxies; and

in response to the web request, receiving scraped content from thetarget web site via the proxy.

The device is presented, wherein the second API request is to retrievethe received scraped content.

The device is presented, the operations further comprising:

sending a message to the client computing device, the message specifyingthe sub-domain for the client computing device to retrieve the scrapedcontent.

The device is presented, wherein the plurality of data centers executingthe web scraping system each operate to accept job requestsindependently of one another, wherein status and results from the APIrequest are stored on one of a plurality of independent, horizontallypartitioned database shards.

The device is presented, wherein the hostname addresses a load balancerthat balances requests among a plurality of servers that accept webscraping requests.

A system for distributing web scraping requests over a plurality of datacenters, comprising:

at least one processor and memory;

a data center balancer configured to (i) receive a first API request toscrape content from a target website and a second API request toretrieve the content once scraped, (ii) direct the first API request toa data center selected from a plurality of data centers, and (iii)direct the second API request to the data center; and

a request intake manager configured to (i) in response to the first APIrequest, initiate web scraping from the target website and to (ii) inresponse to the second API request, return content scraped from thetarget website to a client computing device.

A system for distributing web scraping requests over a plurality of datacenters, comprising:

at least one processor and memory;

a data center balancer configured to (i) receive a first API request toscrape content from a target website and a second API request toretrieve the content once scraped, (ii) direct the first API request toa first data center selected from a plurality of data centers, and (iii)direct the second API request to a second data center selected from theplurality of data centers;

a first request intake manager executed at the first data center, thefirst request intake manager configured to (i) in response to the firstAPI request, initiate web scraping from the target website and to (ii)in response to the second API request, return content scraped from thetarget website to a client computing device; and

a second request intake manager executed at the second data center, thesecond request intake manager configured to in response to the secondAPI request, (i) determine which of the plurality of data centersprocessed the first API request, and to (ii) direct the second APIrequest to the determined data center.

The system is presented further comprising:

a first load balancer executed at the first data center, the first loadbalancer configured to, in response to the first API request: (i) selectthe first request intake manager from a first plurality of first requestintake managers executed at the first data center, and (ii) direct thefirst API request to the selected first request intake manager; and

a second load balancer executed at the second data center, the secondload balancer configured to, in response to the second API request: (i)select the second request intake manager from a second plurality offirst request intake managers executed at the second data center, and(ii) direct the second API request to the selected second request intakemanager;

A computer-implemented method for securing a web scraping system ispresented, comprising:

at an entry point to the web scraping system, performing the following:

(a) validating credentials received with an API request from a clientcomputing device, the API request asking that the web scraping systemscrape content from a target website;

(b) when the credentials are validated, generating a token indicating anidentity of a client associated with the credentials;

(c) transmitting the API request along with the token to a serverconfigured to initiate a scraping process on the web scraping system;

at the server configured to initiate the web scraping system:

(d) analyzing the token to determine whether the client is authorized toconduct the request; and

(e) when the client is authorized, causing the web scraping system toscrape the target web site.

The method is presented, further comprising:

(f) passing the API request between a plurality of servers, eachconfigured to perform a function of the web scraping system, the serverconfigured to initiate the web scraping system being included in theplurality of servers;

at each of the respective servers:

(g) analyzing the token to determine whether the client is authorized toconduct the function performed by the respective server; and

(e) when the client is authorized to conduct the function, performingthe function.

The method is presented, wherein the plurality of servers includes aserver configured to service API requests formatted as a web proxyrequest.

The method is presented, wherein the plurality of servers includes aserver configured to service synchronous API requests, leaving aconnection between the web scraping system and the client computingdevice open while the web scraping system scrapes the target website.

The method is presented, wherein the plurality of servers includes aserver configured to service asynchronous API requests, closing aconnection between the web scraping system and the client computingdevice before the web scraping system scrapes the target web site.

The method is presented, wherein the generating (b) comprises generatingthe token to include a role of the client.

The method is presented, wherein the generating (b) comprises generatingthe token to include a digital signature that cryptographicallyguarantees that the identity of the client has not been tampered with.

The method is presented, wherein the API request is a first API request,and the token is a first token, further comprising:

(f) validating credentials received with a second API request, thesecond API request asking to retrieve content that the web scrapingsystem has previously scraped from the target website;

(g) when the credentials are validated, generating a second tokenindicating an identity of a client associated with the credentialsreceived with the second API request;

(h) determining whether the first and second tokens indicate that thefirst and second API requests came from the client; and

(i) when the first and second tokens indicate that the first and secondAPI requests came from the client, returning the scraped content inresponse to the second API request.

The method is presented, further comprising, when the first and secondtokens do not indicate that the first and second requests came from theclient, refusing to return the scraped content.

The method is presented, wherein the entry point is a load balancer thatselects the server from a plurality of parallel servers.

A non-transitory computer-readable device having instructions storedthereon is presented that, when executed by at least one computingdevice, cause the at least one computing device to perform operations,the operations comprising:

at an entry point to a web scraping system, performing the following:

(a) validating credentials received with an API request from a clientcomputing device, the API request asking that the web scraping systemscrape a target web site;

(b) when the credentials are validated, generating a token indicating anidentity of a client associated with the credentials;

(c) transmitting the API request along with the token to a serverconfigured to initiate a scraping process on the web scraping system;

at the server configured to initiate the web scraping system:

(d) analyzing the token to determine whether the client is authorized toconduct the request; and

(e) when the client is authorized, causing the web scraping system toscrape the target website.

The device is presented, the operations further comprising:

(f) passing the API request between a plurality of servers, eachconfigured to perform a function of the web scraping system, the serverconfigured to initiate the web scraping system being included in theplurality of servers;

at each of the respective servers:

(g) analyzing the token to determine whether the client is authorized toconduct the function performed by the respective server; and

(e) when the client is authorized to conduct the function, performingthe function.

The device is presented, wherein the plurality of servers includes aserver configured to service API requests formatted as a web proxyrequest.

The device is presented, wherein the plurality of servers includes aserver configured to service synchronous API requests, leaving aconnection between the web scraping system and the client computingdevice open while the web scraping system scrapes the target website.

The device is presented, wherein the plurality of servers includes aserver configured to service asynchronous API requests, closing aconnection between the web scraping system and the client computingdevice before the web scraping system scrapes the target web site.

The device is presented, wherein the generating (b) comprises generatingthe token to include a role of the client.

The device is presented, wherein the generating (b) comprises generatingthe token to include a digital signature that cryptographicallyguarantees that the identity of the client has not been tampered with.

The device is presented, wherein the API request is a first API request,and the token is a first token, the operations further comprising:

(f) validating credentials received with a second API request, thesecond API request asking to retrieve content that the web scrapingsystem has previously scraped from the target website;

(g) when the credentials are validated, generating a second tokenindicating an identity of a client associated with the credentialsreceived with the second API request;

(h) determining whether the first and second tokens indicate that thefirst and second requests came from the client; and

(e) when the first and second tokens indicate that the first and secondrequests came from the client, returning the scraped content in responseto the second API request.

The device is presented, the operations further comprising, when thefirst and second tokens do not indicate that the first and secondrequests came from the client, refusing to return the scraped content.

The device is presented, wherein the entry point is a load balancer thatselects the server from a plurality of parallel servers.

A method for aggregating web results scraped from a plurality of datacenters is presented, comprising:

at a first data center of the plurality of data centers, comprising:

(a) generating a first web request for a target website;

(b) transmitting the first web request to the target web site;

(c) in response to the first web request, receiving a first content fromthe target web site;

(d) storing the first content in an archive;

(e) storing a first entry in a first index file, the first entryincluding metadata describing the first content and a first linkaddressing the first content in the archive;

(f) analyzing a search request from a client to determine that searchcriteria in the search request describes the metadata in the firstentry;

at a second data center of the plurality of data centers:

(g) generating a second web request for the target website;

(h) transmitting the second web request to the target web site;

(i) in response to the second web request, receiving a second contentfrom the target website;

(j) storing the second content in the archive;

(k) storing a second entry in a second index file, the second entryincluding metadata describing the second content and a second linkaddressing the second content in the archive;

(l) analyzing the search request from the client to determine that thesearch criteria in the search request describes the metadata in thesecond entry; and

(m) in response to the analyzing (f) and (1), providing to the client afile with the first and second links.

The method is presented, wherein the providing (m) comprises:

storing the file in a database separate from the archive; and

providing the client read access to the database.

The method is presented, wherein the file includes the metadata of thefirst and second entries.

The method is presented, further comprising:

(n) parsing a response from the target web site to the first web requestto determine the first content; and

(o) parsing a response from the target web site to the second webrequest to determine the second content.

The method is presented, further comprising:

(n) determining whether the steps (a)-(e) have occurred during a recenttime period, wherein steps (j)-(k) occur only when the steps (a)-(e)have not occurred during the recent time period.

The method is presented, wherein the determining (n) comprises, at thesecond data center:

receiving, from the first data center, a data feed with additions to thefirst index file;

(ii) storing the additions in a prior scraped file; and

(ii) comparing the metadata describing the second content to the priorscraped file.

The method is presented, further comprising removing metadata from theprior scraped file at an expiration date selected based on the recenttime period.

A non-transitory computer-readable device having instructions storedthereon is presented that, when executed by at least one computingdevice, cause the at least one computing device to perform operations,the operations comprising:

at a first data center of the plurality of data centers, comprising:

(a) generating a first web request for a target website;

(b) transmitting the first web request to the target web site;

(c) in response to the first web request, receiving a first content fromthe target web site;

(d) storing the first content in an archive;

(e) storing a first entry in a first index file, the first entryincluding metadata describing the first content and a first linkaddressing the first content in the archive;

analyzing a search request from a client to determine that searchcriteria in the search request describes the metadata in the firstentry;

at a second data center of the plurality of data centers:

(g) generating a second web request for the target website;

(h) transmitting the second web request to the target web site;

(i) in response to the second web request, receiving a second contentfrom the target website;

(j) storing the second content in the archive;

(k) storing a second entry in a second index file, the second entryincluding metadata describing the second content and a second linkaddressing the second content in the archive;

(l) analyzing the search request from the client to determine that thesearch criteria in the search request describes the metadata in thesecond entry; and

(m) in response to the analyzing (f) and (l), providing to the client afile with the first and second links.

The device is presented, wherein the providing (m) comprises:

storing the file in a database separate from the archive; and

providing the client read access to the database.

The device is presented, wherein the file includes the metadata of thefirst and second entries.

The device is presented, the operations further comprising:

(n) parsing a response from the target web site to the first web requestto determine the first content; and

(o) parsing a response from the target web site to the second webrequest to determine the second content.

The device is presented, the operations further comprising:

(n) determining whether the steps (a)-(e) have occurred during a recenttime period, wherein steps (j)-(k) occur only when the steps (a)-(e)have not occurred during the recent time period.

The device is presented, wherein determining (n) comprises, at thesecond data center:

(i) receiving, from the first data center, a data feed with additions tothe first index file;

(ii) storing the additions in a prior scraped file; and

(ii) comparing the metadata describing the second content to the priorscraped file.

The device is presented, the operations further comprising removingmetadata from the prior scraped file at an expiration date selectedbased on the recent time period.

A system for aggregating web results scraped from a plurality of datacenters is presented, comprising:

a processor;

at least one memory;

an archive database stored in the at least one memory;

a first index file stored in at least one memory at a first data center;

a first scraper at the first data center, the first scraper configuredto (i) generate a first web request for a target web site, (ii) transmitthe first web request to the target web site, and (iii) in response tothe first web request, receive a first content from the target web site;

a first writer at the first data center, the first writer configured to(i) store the first content in an archive and (ii) store a first entryin a first index file, the first entry including metadata describing thefirst content and a first link addressing the first content in thearchive;

a first dumper at the first data center, the first dumper configured toanalyze a search request from a client to determine that search criteriain the search request describes the metadata in the first entry;

a second index file stored in the at least one memory at a second datacenter; a second scraper at the second data center, the second scraperconfigured to (i) generate a second web request for the target web site,(ii) transmit the second web request to the target web site, and (iii)in response to the second web request, receiving a second content fromthe target web site;

a second writer at the second data center, the second writer configuredto (i) store the second content in an archive and (ii) store a secondentry in a second index file, the second entry including metadatadescribing the second content and a second link addressing the secondcontent in the archive;

a second dumper at the second data center, the second dumper configuredto analyze the search request from the client to determine that thesearch criteria in the search request describes the metadata in thesecond entry; and a dump database configured to provide to the client afile with the first and second links.

The system is presented, wherein the file includes the metadata of thefirst and second entries.

The system is presented, the operations further comprising:

a first parser at the first data center, the first parser configured toparse a response from the target web site to the first web request todetermine the first content; and a second parser at the second datacenter, the second parser configured to parse a response from the targetweb site to the second web request to determine the second content.

The system is presented, wherein the second writer is configured todetermine whether the first writer has recorded the target web site inthe archive during a recent time period, wherein the second writer isconfigured to record the target website in the archive only when thefirst writer has not during the recent time period.

The system is presented, wherein further comprising, at the second datacenter:

a prior scraped file stored in the at least one memory;

a feed receiver configured to receive, from the first data center, adata feed with additions to the first index file and to storing theadditions in the prior scraped file, wherein the writer is configured tocompare the metadata describing the second content to the prior scrapedfile.

The system is presented, wherein metadata is removed from the priorscraped file at an expiration date selected based on the recent timeperiod.

A method for scraping web results via a proxy is presented, comprising:

(a) receiving an API request from a client computing device, the APIrequest specifying a target web site to scrape;

(b) based on the target website, selecting a scraper specifying how togenerate a sequence of HTTP requests to access content requested by theAPI request;

(c) based on the selected scraper and received API request, generatingan earlier HTTP request in the sequence of HTTP requests;

(d) transmitting, to the target website and via a proxy selected from agroup of proxies, the earlier HTTP request;

(e) receiving, from the target web site and via the proxy selected fromthe group of proxies, a response to the earlier HTTP request, theresponse including session data;

based on the selected scraper and received API request, generating alater HTTP request in the sequence of HTTP requests such that the laterHTTP request includes the session data;

(g) receiving, from the target web site and via the proxy selected fromthe group of proxies, from the a response to the later HTTP request, theresponse including the scraped web results; and

(h) transmitting to the client computing device the scraped web results.

A method as in any of the above claims is presented, further comprising:

according to the API request and the selected scraper, generating a pathto use in the earlier HTTP request.

A method as in any of the above methods is presented, wherein the APIrequest specifies a geographic location, further comprising:

selecting the proxy based on the group of proxies such that an IPaddress of the selected proxy is located in the geographic location.

A method as in any of the above claims, wherein the API requestspecifies a geographic location, further comprising:

determining at least one header value to use in the earlier and laterHTTP requests such that the at least one header identifies to the targetwebsite that the earlier and later HTTP requests originated from thegeographic location.

A method as in any of the above methods is presented, furthercomprising:

determining at least one header value to use in the earlier and laterHTTP requests to mimic what a browser at the proxy would generate.

A method as in any of the above claims, further comprising:

determining whether the target website as requested in the API requesthas been recently scraped from the target website and the recent scrapedresults stored in a cache;

when the recent scraped results are determined not to be stored in thecache, executing steps (b)-(h); and

when the recent scraped results are determined to be stored in thecache, transmitting the recently scraped results as a response to theAPI request.

A method as in any of the above methods is presented, wherein the APIrequest is an HTTP request from the client computing device, wherein thetransmitting (h) comprises transmitting the scraped web results as anHTTP response to the HTTP request from the client computing device.

A method as in any of the above methods is presented, when the receiving(g) is complete transmitting, to the client computing device, a callbackmessage.

A method as in any of the above claims, wherein the API request is anHTTP proxy protocol request, and wherein the transmitting (h) comprisestransmitting the scraped results as a response to the HTTP proxyprotocol request.

A method as in any of the above methods is presented, furthercomprising:

retrieving, by a headless browser, additional content that would beneeded to render a web page specified by the scraped results.

A method as in any of the above methods is presented, furthercomprising:

selecting the proxy from the group of proxies to prevent any proxy fromthe group of proxies from being identified as a bot.

A method as in any of the above methods is presented, the API requestspecifying a user-agent, further comprising:

determining at least one header value to use in the earlier and laterHTTP requests to mimic the user agent.

A method as in any of the above methods is presented, furthercomprising:

receiving both synchronous and asynchronous API requests to scrape webdata; and

prioritizing processing of the synchronous API requests above processingof the asynchronous API requests.

A method as in any of the above methods is presented, wherein theresponse to the earlier HTTP request includes an HTML, page with a formto submit information to a URI, wherein the later HTTP request includesa path with the URI.

A method as in any of the above methods is presented, wherein the APIrequest includes a value, wherein the response to the earlier HTTPrequest includes an HTML page with a form with a parameter name, whereinthe later HTTP request indicates that the parameter name corresponds tothe value.

A method as in any of the above methods is presented, wherein the APIrequest includes a value matched to one of several parameter names,further comprising normalizing the API request to a common format.

A method as in any of the above methods is presented, further comprisinggenerating a job identifier based on a server servicing the API request.

A method as in any of the above methods is presented, further comprisingstoring status of a web scraping job specified in the API request in anin-memory table.

A method as in any of the above methods is presented, further comprisingstoring status of a web scraping job in a horizontally partitioneddatabase.

A system for scraping web results via a proxy in presented, comprising:

a means for receiving an API request from a client computing device, theAPI request specifying a target website to scrape;

a means for, based on the target website, selecting a scraper specifyinghow to generate a sequence of HTTP requests to access content requestedby the API request;

a means for, based on the selected scraper and received API request,generating an earlier HTTP request in the sequence of HTTP requests;

a means for transmitting, to the target website and via a proxy selectedfrom a group of proxies, the earlier HTTP request;

a means for receiving, from the target website and via the proxyselected from the group of proxies, a response to the earlier HTTPrequest, the response including a session data;

a means for, based on the selected scraper and received API request,generating a later HTTP request in the sequence of HTTP requests suchthat the later HTTP request includes the session data;

a means for receiving, from the target website and via the proxyselected from the group of proxies, from the a response to the laterHTTP request, the response including the scraped web results; and

a means for transmitting to the client computing device the scraped webresults.

What is claimed is:
 1. A computer-implemented method for securing a webscraping system, comprising: (a) receiving, at a load balancer, an APIrequest to scrape content from a target website from a client computingdevice; (b) generating a token indicating an identity of a clientassociated with the API request; (c) identifying a server configured toinitiate a scraping process on the web scraping system based on thehostname in the API request; (d) transmitting the API request along withthe token to the server; at the server configured to initiate thescraping process on the web scraping system: (e) authorizing the clientusing the token; and (f) causing the web scraping system to scrape thetarget website in response to the authorization.
 2. The method of claim1, further comprising: (g) passing the API request between a pluralityof servers, each configured to perform a function of the web scrapingsystem, the server configured to initiate the web scraping system beingincluded in the plurality of servers; at each of the respective servers:(h) analyzing the token to determine whether the client is authorized toconduct the function performed by the respective server; and (i) whenthe client is authorized to conduct the function, performing thefunction.
 3. The method of claim 2, wherein the plurality of serversincludes a server configured to service API requests formatted as a webproxy request.
 4. The method of claim 1, wherein the hostname indicatesthat API request is to be transmitted to a server configured to servicesynchronous API requests, wherein the server configured to servicesynchronous API requests leaves a connection between the web scrapingsystem and the client computing device open while the web scrapingsystem scrapes the target website.
 5. The method of claim 1, wherein thehostname indicates that API request is to be transmitted to a serverconfigured to service asynchronous API requests, wherein the serverconfigured to service asynchronous API requests closes a connectionbetween the web scraping system and the client computing device beforethe web scraping system scrapes the target website.
 6. The method ofclaim 1, wherein the generating (b) comprises generating the token toinclude a role of the client.
 7. The method of claim 1, wherein thegenerating (b) comprises generating the token to include a digitalsignature that cryptographically guarantees that the identity of theclient has not been tampered with.
 8. The method of claim 1, wherein theAPI request is a first API request, and the token is a first token,further comprising: (g) receiving a second API request asking toretrieve content that the web scraping system has previously scrapedfrom the target website; (h) generating a second token indicating anidentity of a client associated with the second API request; (i)determining whether the first and second tokens indicate that the firstand second API requests came from the client; and (j) when the first andsecond tokens indicate that the first and second API requests came fromthe client, returning the scraped content in response to the second APIrequest.
 9. The method of claim 8, further comprising, when the firstand second tokens do not indicate that the first and second requestscame from the client, refusing to return the scraped content.
 10. Themethod of claim 1, wherein the load balancer selects the server from aplurality of parallel servers.
 11. A non-transitory computer-readabledevice having instructions stored thereon that, when executed by atleast one computing device, cause the at least one computing device toperform operations, the operations comprising: (a) receiving, at a loadbalancer, an API request to scrape content from a target website from aclient computing device; (b) generating a token indicating an identityof a client associated with the API request; (c) identifying a serverconfigured to initiate a scraping process on the web scraping systembased on the hostname in the API request; (d) transmitting the APIrequest along with the token to the server; at the server configured toinitiate the scraping process on the web scraping system: (e)authorizing the client using the token; causing the web scraping systemto scrape the target website in response to the authorization.
 12. Thedevice of claim 11, the operations further comprising: (g) passing theAPI request between a plurality of servers, each configured to perform afunction of the web scraping system, the server configured to initiatethe web scraping system being included in the plurality of servers; ateach of the respective servers: (h) analyzing the token to determinewhether the client is authorized to conduct the function performed bythe respective server; and (i) when the client is authorized to conductthe function, performing the function.
 13. The device of claim 12,wherein the plurality of servers includes a server configured to serviceAPI requests formatted as a web proxy request.
 14. The device of claim11, wherein the hostname indicates that API request is to be transmittedto a server configured to service synchronous API requests, wherein theserver configured to service synchronous API requests leaves aconnection between the web scraping system and the client computingdevice open while the web scraping system scrapes the target website.15. The device of claim 11, wherein the hostname indicates that APIrequest is to be transmitted to a server configured to serviceasynchronous API requests, wherein the server configured to serviceasynchronous API requests closes a connection between the web scrapingsystem and the client computing device before the web scraping systemscrapes the target website.
 16. The device of claim 11, wherein thegenerating (b) comprises generating the token to include a role of theclient.
 17. The device of claim 11, wherein the generating (b) comprisesgenerating the token to include a digital signature thatcryptographically guarantees that the identity of the client has notbeen tampered with.
 18. The device of claim 11, wherein the API requestis a first API request, and the token is a first token, the operationsfurther comprising: (g) receiving a second API request asking toretrieve content that the web scraping system has previously scrapedfrom the target website; (g) generating a second token indicating anidentity of a client associated with the second API request; (h)determining whether the first and second tokens indicate that the firstand second requests came from the client; and (e) when the first andsecond tokens indicate that the first and second requests came from theclient, returning the scraped content in response to the second APIrequest.
 19. The device of claim 18, the operations further comprising,when the first and second tokens do not indicate that the first andsecond requests came from the client, refusing to return the scrapedcontent.
 20. The device of claim 11, wherein the load balancer selectsthe server from a plurality of parallel servers